Skip to content

Commit

Permalink
drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
Browse files Browse the repository at this point in the history
The > should be >= so that we don't read one element beyond the end of
the vega20_message_map[] array.

Fixes: 78031c2 ("drm/amd/powerplay: implement smu vega20_message_map for vega20")
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Dan Carpenter authored and Alex Deucher committed Mar 21, 2019
1 parent 06b61d4 commit 8513027
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/powerplay/vega20_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ static int vega20_message_map[SMU_MSG_MAX_COUNT] = {
static int vega20_get_smu_msg_index(struct smu_context *smc, uint32_t index)
{
int val;
if (index > SMU_MSG_MAX_COUNT)

if (index >= SMU_MSG_MAX_COUNT)
return -EINVAL;

val = vega20_message_map[index];
Expand Down

0 comments on commit 8513027

Please sign in to comment.