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

drm/amdgpu: fix array out of bounds

When the initial value of i is greater than zero,
it may cause endless loop, resulting in array out
of bounds, fix it.

This is a port of the radeon fix to amdgpu.

Signed-off-by: tom will <os@iscas.ac.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

tom will and committed by
Alex Deucher
484f689f a8efd588

+1 -1
+1 -1
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
··· 2252 2252 if (pi->caps_stable_p_state) { 2253 2253 stable_p_state_sclk = (max_limits->sclk * 75) / 100; 2254 2254 2255 - for (i = table->count - 1; i >= 0; i++) { 2255 + for (i = table->count - 1; i >= 0; i--) { 2256 2256 if (stable_p_state_sclk >= table->entries[i].clk) { 2257 2257 stable_p_state_sclk = table->entries[i].clk; 2258 2258 break;