Merge pull request #868 from devmapal/master

Fixes issues in sys_semaphore_create() and sys_event_flag_(create/get)()
This commit is contained in:
Alexandro Sánchez Bach 2014-11-17 04:29:39 +01:00
commit 427fd58ef2
2 changed files with 19 additions and 1 deletions

View File

@ -42,6 +42,18 @@ s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> at
sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
eflag_id.addr(), attr.addr(), init);
if (eflag_id.addr() == NULL)
{
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (eflag_id_addr=0x%x)", eflag_id.addr());
return CELL_EFAULT;
}
if (attr.addr() == NULL)
{
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (attr_addr=0x%x)", attr.addr());
return CELL_EFAULT;
}
switch (attr->protocol.ToBE())
{
case se32(SYS_SYNC_PRIORITY): break;
@ -358,6 +370,12 @@ s32 sys_event_flag_get(u32 eflag_id, vm::ptr<u64> flags)
{
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr());
if (flags.addr() == NULL)
{
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (flags_addr=0x%x)", flags.addr());
return CELL_EFAULT;
}
EventFlag* ef;
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;

View File

@ -33,7 +33,7 @@ s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute> attr
if (attr.addr() == NULL) {
sys_semaphore.Error("sys_semaphore_create(): An invalid argument value is specified (attr_addr=0x%x)", attr.addr());
return CELL_EINVAL;
return CELL_EFAULT;
}
if (max_count <= 0 || initial_count > max_count || initial_count < 0)