Commit d2bd0831 authored by Alexey Kodanev's avatar Alexey Kodanev Committed by Alex Deucher
Browse files

drm/amd/pm: smu7_hwmgr: fix potential off-by-one overflow in 'performance_levels'



Since 'hardwareActivityPerformanceLevels' is set to the size of the
'performance_levels' array in smu7_hwmgr_backend_init(), using the
'<=' assertion to check for the next index value is incorrect.
Replace it with '<'.

Detected using the static analysis tool - Svace.
Fixes: 599a7e9f ("drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.")
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlexey Kodanev <aleksei.kodanev@bell-sw.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2cc4a591
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3603,7 +3603,7 @@ static int smu7_get_pp_table_entry_callback_func_v1(struct pp_hwmgr *hwmgr,
			return -EINVAL);

	PP_ASSERT_WITH_CODE(
			(smu7_power_state->performance_level_count <=
			(smu7_power_state->performance_level_count <
					hwmgr->platform_descriptor.hardwareActivityPerformanceLevels),
			"Performance levels exceeds Driver limit!",
			return -EINVAL);