Skip to contentSkip to conversation

drm/amd/powerplay: add point check to avoid NULL point hang.

bug report Dan Carpenter 2 participants 2 messages Aug 25, 2020 – Aug 26, 2020

lore
Share & tools
lore
#0 lore raw

Hello Rex Zhu,

The patch 88b8dcbe21fd: "drm/amd/powerplay: add point check to avoid NULL point hang." from Dec 11, 2015, leads to the following static checker warning:

drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/hardwaremanager.c:274 phm_check_smc_update_required_for_display_configuration()
warn: signedness bug returning '(-22)'

drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/hardwaremanager.c
272 bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr) 273 {
274 PHM_FUNC_CHECK(hwmgr);

PHM_FUNC_CHECK() has a hiddren -EINVAL return that becomes true when casted to bool.

   275          if (hwmgr->pp_one_vf)
   276                  return false;
   277  
   278          if (hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL)
   279                  return false;
   280  
   281          return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr);
   282  }

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Thanks. I just sent out a patch to address this.

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Dan Carpenter
Sent: Tuesday, August 25, 2020 6:24 PM
To: [email protected]
Cc: [email protected]
Subject: [bug report] drm/amd/powerplay: add point check to avoid NULL point hang.

Hello Rex Zhu,

The patch 88b8dcbe21fd: "drm/amd/powerplay: add point check to avoid NULL point hang." from Dec 11, 2015, leads to the following static checker warning:

drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/hardwaremanager.c:274 phm_check_smc_update_required_for_display_configuration()
warn: signedness bug returning '(-22)'

drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/hardwaremanager.c
272 bool phm_check_smc_update_required_for_display_configuration(struct pp_hwmgr *hwmgr) 273 {
274 PHM_FUNC_CHECK(hwmgr);

PHM_FUNC_CHECK() has a hiddren -EINVAL return that becomes true when casted to bool.

   275          if (hwmgr->pp_one_vf)
   276                  return false;
   277
   278          if (hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration == NULL)
   279                  return false;
   280
   281          return hwmgr->hwmgr_func->check_smc_update_required_for_display_configuration(hwmgr);
   282  }

regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7Cd3cadb4b92e04c5d4eae08d848e111a0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637339478834526298&amp;sdata=236vygLQdbMVXk6XBDaayrTw2qODhcmTCFvtl0%2B95IM%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx