drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()

The > should be >= so that we don't read one element beyond the end of
the vega20_message_map[] array.

Fixes: 78031c2c4d ("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>
This commit is contained in:
Dan Carpenter 2019-03-21 12:19:57 +03:00 committed by Alex Deucher
parent 06b61d4a3c
commit 8513027a73

View File

@ -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];