mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-08 16:01:42 +12:00
IsGood() check elimination
Reasons: 1) It's unsafe - we cannot guarantee that address is still good while it is used. 2) It's wrong in many modules which are usually just compare pointer with zero.
This commit is contained in:
parent
48514b0e93
commit
8f04ab07ed
52 changed files with 104 additions and 1450 deletions
|
@ -25,11 +25,6 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value)
|
|||
{
|
||||
cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
if(!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
|
||||
|
@ -118,9 +113,6 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> buf, u32 bufsize)
|
|||
{
|
||||
cellSysutil->Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.GetAddr(), bufsize);
|
||||
|
||||
if (!buf.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
memset(buf, 0, bufsize);
|
||||
|
||||
switch(id)
|
||||
|
@ -184,9 +176,6 @@ int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution
|
|||
cellSysutil->Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)",
|
||||
resolutionId, resolution.GetAddr());
|
||||
|
||||
if (!resolution.IsGood())
|
||||
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
|
||||
|
||||
u32 num = ResolutionIdToNum(resolutionId);
|
||||
if(!num)
|
||||
return CELL_EINVAL;
|
||||
|
@ -202,11 +191,6 @@ s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 wa
|
|||
cellSysutil->Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)",
|
||||
videoOut, config_addr, option_addr, waitForEvent);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration)))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
CellVideoOutConfiguration& config = (CellVideoOutConfiguration&)Memory[config_addr];
|
||||
|
||||
switch(videoOut)
|
||||
|
@ -243,8 +227,6 @@ int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr)
|
|||
cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
||||
videoOut, config_addr, option_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT;
|
||||
|
||||
CellVideoOutConfiguration config = {};
|
||||
|
||||
switch(videoOut)
|
||||
|
@ -502,11 +484,6 @@ int cellAudioOutConfigure(u32 audioOut, mem_ptr_t<CellAudioOutConfiguration> con
|
|||
cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, (!)waitForEvent=%d)",
|
||||
audioOut, config.GetAddr(), option.GetAddr(), waitForEvent);
|
||||
|
||||
if (!config.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch(audioOut)
|
||||
{
|
||||
case CELL_AUDIO_OUT_PRIMARY:
|
||||
|
@ -536,8 +513,6 @@ int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr)
|
|||
cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
||||
audioOut, config_addr, option_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT;
|
||||
|
||||
CellAudioOutConfiguration config = {};
|
||||
|
||||
switch(audioOut)
|
||||
|
@ -695,9 +670,6 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_
|
|||
cellSysutil->Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)",
|
||||
version, dirName_addr, errDialog, funcStat, container);
|
||||
|
||||
if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood())
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
std::string dirName = Memory.ReadString(dirName_addr);
|
||||
if (dirName.size() != 9)
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue