Skip to content

Commit

Permalink
drm/radeon/dpm/btc: off by one in btc_set_mc_special_registers()
Browse files Browse the repository at this point in the history
It should be ">=" instead of ">" here.  The table->mc_reg_address[]
array has SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE (16) elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Dan Carpenter authored and Alex Deucher committed Oct 9, 2013
1 parent 89cd67b commit 96d8df8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/radeon/btc_dpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
}
j++;

if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
return -EINVAL;

tmp = RREG32(MC_PMG_CMD_MRS);
Expand All @@ -1945,7 +1945,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
}
j++;

if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
return -EINVAL;
break;
case MC_SEQ_RESERVE_M >> 2:
Expand All @@ -1959,7 +1959,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev,
}
j++;

if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE)
return -EINVAL;
break;
default:
Expand Down

0 comments on commit 96d8df8

Please sign in to comment.