summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authortom will <os@iscas.ac.cn>2016-05-16 06:58:11 +0200
committerAlex Deucher <alexander.deucher@amd.com>2016-05-16 16:25:13 +0200
commita8efd58815a8d8bdca409a4b8319281cd9c24f7f (patch)
tree07d87940890b71b4c46808562b053d75de00ce8c /drivers
parentdrm/amd/powerplay: fix a bug on updating sclk for Tonga (diff)
downloadlinux-a8efd58815a8d8bdca409a4b8319281cd9c24f7f.tar.xz
linux-a8efd58815a8d8bdca409a4b8319281cd9c24f7f.zip
drm/radeon: 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. Signed-off-by: tom will <os@iscas.ac.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index d0240743a17c..a7e978677937 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
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;