Commit 5fd9c581 authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Deucher

drm/radeon/dpm: off by one in si_set_mc_special_registers()

These checks should be ">=" instead of ">".  j is used as an offset into
the table->mc_reg_address[] array and that has
SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE (16) elements.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent 96d8df84
...@@ -5208,7 +5208,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, ...@@ -5208,7 +5208,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
table->mc_reg_table_entry[k].mc_data[j] |= 0x100; table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
} }
j++; j++;
if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
return -EINVAL; return -EINVAL;
if (!pi->mem_gddr5) { if (!pi->mem_gddr5) {
...@@ -5218,7 +5218,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, ...@@ -5218,7 +5218,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
table->mc_reg_table_entry[k].mc_data[j] = table->mc_reg_table_entry[k].mc_data[j] =
(table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16; (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16;
j++; j++;
if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -5231,7 +5231,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, ...@@ -5231,7 +5231,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev,
(temp_reg & 0xffff0000) | (temp_reg & 0xffff0000) |
(table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
j++; j++;
if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE)
return -EINVAL; return -EINVAL;
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment