mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-01-18 14:40:22 +01:00
Minor EFAULT fix in sys_semaphore_get_value/sys_event_flag_get
ESRCH preceeds EFAULT in both syscalls.
This commit is contained in:
parent
9266507e4c
commit
7680466e0d
|
|
@ -410,11 +410,6 @@ error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags)
|
|||
|
||||
sys_event_flag.trace("sys_event_flag_get(id=0x%x, flags=*0x%x)", id, flags);
|
||||
|
||||
if (!flags)
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
const auto flag = idm::check<lv2_obj, lv2_event_flag>(id, [](lv2_event_flag& flag)
|
||||
{
|
||||
return +flag.pattern;
|
||||
|
|
@ -422,10 +417,15 @@ error_code sys_event_flag_get(ppu_thread& ppu, u32 id, vm::ptr<u64> flags)
|
|||
|
||||
if (!flag)
|
||||
{
|
||||
*flags = 0;
|
||||
if (flags) *flags = 0;
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (!flags)
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
*flags = flag.ret;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,11 +265,6 @@ error_code sys_semaphore_get_value(ppu_thread& ppu, u32 sem_id, vm::ptr<s32> cou
|
|||
|
||||
sys_semaphore.trace("sys_semaphore_get_value(sem_id=0x%x, count=*0x%x)", sem_id, count);
|
||||
|
||||
if (!count)
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
const auto sema = idm::check<lv2_obj, lv2_sema>(sem_id, [](lv2_sema& sema)
|
||||
{
|
||||
return std::max<s32>(0, sema.val);
|
||||
|
|
@ -280,6 +275,11 @@ error_code sys_semaphore_get_value(ppu_thread& ppu, u32 sem_id, vm::ptr<s32> cou
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
*count = sema.ret;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue