]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/radeon: fix array out of bounds
authortom will <os@iscas.ac.cn>
Mon, 16 May 2016 04:58:11 +0000 (21:58 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 16 May 2016 14:25:13 +0000 (10:25 -0400)
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>
drivers/gpu/drm/radeon/kv_dpm.c

index d0240743a17c16f6285f237e4f2b7925866ea32f..a7e9786779378f5372e8a064c82748a27768f8b9 100644 (file)
@@ -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;