summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortom will <os@iscas.ac.cn>2016-05-16 16:31:07 +0200
committerAlex Deucher <alexander.deucher@amd.com>2016-05-16 16:31:07 +0200
commit484f689fc9d4eb91c68f53e97dc355b1b06c3edb (patch)
tree2bd9ca7344ba2c2f62e84c4d0320dd605884ef05
parentdrm/radeon: fix array out of bounds (diff)
downloadlinux-484f689fc9d4eb91c68f53e97dc355b1b06c3edb.tar.xz
linux-484f689fc9d4eb91c68f53e97dc355b1b06c3edb.zip
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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index b45f54714574..a789a863d677 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2252,7 +2252,7 @@ static void kv_apply_state_adjust_rules(struct amdgpu_device *adev,
if (pi->caps_stable_p_state) {
stable_p_state_sclk = (max_limits->sclk * 75) / 100;
- for (i = table->count - 1; i >= 0; i++) {
+ for (i = table->count - 1; i >= 0; i--) {
if (stable_p_state_sclk >= table->entries[i].clk) {
stable_p_state_sclk = table->entries[i].clk;
break;