Commit 5556b9fe authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Deucher

drm/amd/powerplay: Fix an off by one in navi10_get_smu_msg_index()

The navi10_message_map[] array has SMU_MSG_MAX_COUNT elements so the ">"
has to be changed to ">=" to prevent reading one element beyond the end
of the array.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ed8a5fb2
...@@ -213,7 +213,7 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index) ...@@ -213,7 +213,7 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)
{ {
struct smu_11_0_cmn2aisc_mapping mapping; struct smu_11_0_cmn2aisc_mapping mapping;
if (index > SMU_MSG_MAX_COUNT) if (index >= SMU_MSG_MAX_COUNT)
return -EINVAL; return -EINVAL;
mapping = navi10_message_map[index]; mapping = navi10_message_map[index];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment