]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.11.6/drm-radeon-dpm-off-by-one-in-si_set_mc_special_registers.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.11.6 / drm-radeon-dpm-off-by-one-in-si_set_mc_special_registers.patch
1 From 5fd9c581862a4874c0bdaf16231d8873832bbb99 Mon Sep 17 00:00:00 2001
2 From: Dan Carpenter <dan.carpenter@oracle.com>
3 Date: Sat, 28 Sep 2013 12:35:31 +0300
4 Subject: drm/radeon/dpm: off by one in si_set_mc_special_registers()
5
6 From: Dan Carpenter <dan.carpenter@oracle.com>
7
8 commit 5fd9c581862a4874c0bdaf16231d8873832bbb99 upstream.
9
10 These checks should be ">=" instead of ">". j is used as an offset into
11 the table->mc_reg_address[] array and that has
12 SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE (16) elements.
13
14 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
15 Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/gpu/drm/radeon/si_dpm.c | 6 +++---
20 1 file changed, 3 insertions(+), 3 deletions(-)
21
22 --- a/drivers/gpu/drm/radeon/si_dpm.c
23 +++ b/drivers/gpu/drm/radeon/si_dpm.c
24 @@ -5174,7 +5174,7 @@ static int si_set_mc_special_registers(s
25 table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
26 }
27 j++;
28 - if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
29 + if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
30 return -EINVAL;
31
32 if (!pi->mem_gddr5) {
33 @@ -5184,7 +5184,7 @@ static int si_set_mc_special_registers(s
34 table->mc_reg_table_entry[k].mc_data[j] =
35 (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16;
36 j++;
37 - if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
38 + if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
39 return -EINVAL;
40 }
41 break;
42 @@ -5197,7 +5197,7 @@ static int si_set_mc_special_registers(s
43 (temp_reg & 0xffff0000) |
44 (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
45 j++;
46 - if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
47 + if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
48 return -EINVAL;
49 break;
50 default: