summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-10-11 13:44:46 +0300
committerAlex Deucher <alexander.deucher@amd.com>2016-10-14 01:25:49 +0300
commite07053241b0264e7b107b2b3f4d899635985d353 (patch)
tree279d3fcc070fa8b97b7505fa3d9033b8e155d0dd /drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
parent02cfb5fccb0f9f968f0e208d89d9769aa16267bc (diff)
downloadlinux-e07053241b0264e7b107b2b3f4d899635985d353.tar.xz
drm/amd/powerplay: fix static checker warnings in iceland_smc.c
add array length check to avoid buffer overflow. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
index eda802bc63c8..8c889caba420 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
@@ -2458,7 +2458,7 @@ static int iceland_set_mc_special_registers(struct pp_hwmgr *hwmgr,
PP_ASSERT_WITH_CODE((j <= SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE),
"Invalid VramInfo table.", return -EINVAL);
- if (!data->is_memory_gddr5) {
+ if (!data->is_memory_gddr5 && j < SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE) {
table->mc_reg_address[j].s1 = mmMC_PMG_AUTO_CMD;
table->mc_reg_address[j].s0 = mmMC_PMG_AUTO_CMD;
for (k = 0; k < table->num_entries; k++) {