drm/amd/powerplay: initialize a variable before using it
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: initialize a variable before using it
Function vega10_apply_state_adjust_rules() only initializes stable_pstate_sclk_dpm_percentage when data->registry_data.stable_pstate_sclk_dpm_percentage is not between 1 and 100. The variable is then used to compute stable_pstate_sclk, which therefore uses an uninitialized value.
Fix this by initializing stable_pstate_sclk_dpm_percentage to data->registry_data.stable_pstate_sclk_dpm_percentage.
This issue has been found while building the kernel with clang. The compiler reported a -Wsometimes-uninitialized warning.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -0
@@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) { + stable_pstate_sclk_dpm_percentage = + data->registry_data.stable_pstate_sclk_dpm_percentage; PP_ASSERT_WITH_CODE( data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 && data->registry_data.stable_pstate_sclk_dpm_percentage <= 100,
Signature · 1 line
2.14.1
Quoted 33 lines · Nicolas Iooss
Function
vega10_apply_state_adjust_rules()only initializesstable_pstate_sclk_dpm_percentagewhendata->registry_data.stable_pstate_sclk_dpm_percentageis not between 1 and 100. The variable is then used to computestable_pstate_sclk, which therefore uses an uninitialized value.Fix this by initializing
stable_pstate_sclk_dpm_percentagetodata->registry_data.stable_pstate_sclk_dpm_percentage.This issue has been found while building the kernel with clang. The compiler reported a -Wsometimes-uninitialized warning.
Fixes f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")Signed-off-by Nicolas Iooss <[email protected]>--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2
-1@@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) { + stable_pstate_sclk_dpm_percentage = + data->registry_data.stable_pstate_sclk_dpm_percentage; PP_ASSERT_WITH_CODE( data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 && data->registry_data.stable_pstate_sclk_dpm_percentage <= 100, --
Quoted 1 line
2.14.1
Hello,
I have not received any comment on the above patch that I sent two months ago, and the issue which is fixed by it still exists in today's linux-next code [1]. Could you please review this patch?
Thanks,
Nicolas
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 27 lines · Nicolas Iooss
Quoted 25 lines · Nicolas Iooss
Function
vega10_apply_state_adjust_rules()only initializesstable_pstate_sclk_dpm_percentagewhendata->registry_data.stable_pstate_sclk_dpm_percentageis not between 1 and 100. The variable is then used to computestable_pstate_sclk, which therefore uses an uninitialized value.Fix this by initializing
stable_pstate_sclk_dpm_percentagetodata->registry_data.stable_pstate_sclk_dpm_percentage.This issue has been found while building the kernel with clang. The compiler reported a -Wsometimes-uninitialized warning.
Fixes f83a9991648b ("drm/amd/powerplay: add Vega10 powerplay support (v5)")Signed-off-by Nicolas Iooss <[email protected]>--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -3043,6 +3043,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
Quoted 14 lines
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2
-1if (phm_cap_enabled (hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) { + stable_pstate_sclk_dpm_percentage = + data->registry_data.stable_pstate_sclk_dpm_percentage; PP_ASSERT_WITH_CODE( data->registry_data.stable_pstate_sclk_dpm_percentage >= 1 && data->registry_data.stable_pstate_sclk_dpm_percentage <= 100, --2.14.1
Hello,
I have not received any comment on the above patch that I sent two months ago, and the issue which is fixed by it still exists in today's linux-next code [1]. Could you please review this patch?
Reviewed and applied. Sorry for missing this. Feel free to ping sooner if it looks like something slipped through the cracks.
Thanks,
Alex
Quoted 9 lines
Thanks,
Nicolas[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c#n3137
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel