summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/kv_dpm.c
diff options
context:
space:
mode:
authortom will <os@iscas.ac.cn>2016-05-16 07:58:11 +0300
committerAlex Deucher <alexander.deucher@amd.com>2016-05-16 17:25:13 +0300
commita8efd58815a8d8bdca409a4b8319281cd9c24f7f (patch)
tree07d87940890b71b4c46808562b053d75de00ce8c /drivers/gpu/drm/radeon/kv_dpm.c
parente2ed8a132a70dc61ef6d9979bec4f37a3abbba4b (diff)
downloadlinux-a8efd58815a8d8bdca409a4b8319281cd9c24f7f.tar.xz
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/gpu/drm/radeon/kv_dpm.c')
-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;