drm/radeon: fix array out-of-bounds read and write issues
authorColin Ian King <colin.king@canonical.com>
Wed, 24 Jun 2020 12:07:10 +0000 (13:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:50 +0000 (08:23 +0200)
commit519fabb88d7fdcea200a438d85b338244f4e905a
tree0acbd67a08e95f39e8b6b823c2ea6ba61e850cd9
parent251f7e2972a154e63d37b9423477309f68d4af9f
drm/radeon: fix array out-of-bounds read and write issues

[ Upstream commit 7ee78aff9de13d5dccba133f4a0de5367194b243 ]

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: cc8dbbb4f62a ("drm/radeon: add dpm support for CI dGPUs (v2)")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/radeon/ci_dpm.c