The > should be >= so that we don't read one element beyond the end of
the vega20_message_map[] array.
Fixes: 78031c2c4dcd ("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>
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];