Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()

In the PP_OD_EDIT_VDDC_CURVE case the "input_index" variable is capped at
2 but not checked for negative values so it results in an out of bounds
read. This value comes from the user via sysfs.

Fixes: d5bf26539494 ("drm/amd/powerplay: added vega20 overdrive support V3")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dan Carpenter and committed by
Alex Deucher
d27252b5 bd3fe587

+2 -1
+2 -1
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
··· 2961 2961 data->od8_settings.od8_settings_array; 2962 2962 OverDriveTable_t *od_table = 2963 2963 &(data->smc_state_table.overdrive_table); 2964 - int32_t input_index, input_clk, input_vol, i; 2964 + int32_t input_clk, input_vol, i; 2965 + uint32_t input_index; 2965 2966 int od8_id; 2966 2967 int ret; 2967 2968