Skip to content

Commit 7ee78af

Browse files
Colin Ian Kingalexdeucher
authored andcommitted
drm/radeon: fix array out-of-bounds read and write issues
There is an off-by-one bounds check on the index into arrays table->mc_reg_address and table->mc_reg_table_entry[k].mc_data[j] that can lead to reads and writes outside of arrays. Fix the bound checking off-by-one error. Addresses-Coverity: ("Out-of-bounds read/write") Fixes: cc8dbbb ("drm/radeon: add dpm support for CI dGPUs (v2)") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 57f0185 commit 7ee78af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/radeon/ci_dpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4351,7 +4351,7 @@ static int ci_set_mc_special_registers(struct radeon_device *rdev,
43514351
table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
43524352
}
43534353
j++;
4354-
if (j > SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE)
4354+
if (j >= SMU7_DISCRETE_MC_REGISTER_ARRAY_SIZE)
43554355
return -EINVAL;
43564356

43574357
if (!pi->mem_gddr5) {

0 commit comments

Comments
 (0)