drm/amd/powerplay: Fix an off by one in navi10_get_smu_msg_index()
Subsystems (3)
PATCH 1/1 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 Dan Carpenter <[email protected]>
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -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; -if (index >SMU_MSG_MAX_COUNT ) +if (index >=SMU_MSG_MAX_COUNT )return -EINVAL ; mapping = navi10_message_map[index];
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
AppliedQuoted 6 lines · Dan Carpenter
The navi10_message_map[] array has
SMU_MSG_MAX_COUNTelements so the ">" has to be changed to ">=" to prevent reading one element beyond the end of the array.Signed-off-by Dan Carpenter <[email protected]>
Applied. thanks!
Alex
Quoted 24 lines
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1
-2@@ -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; -if (index >SMU_MSG_MAX_COUNT ) +if (index >=SMU_MSG_MAX_COUNT )return -EINVAL ; mapping = navi10_message_map[index]; --2.20.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx