drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
Subsystems (3)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -1
@@ -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];
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
________________________________
From: Dan Carpenter <[email protected]>
Sent: Thursday, March 21, 2019 5:19 PM
To: Deucher, Alexander; Wang, Kevin(Yang)
Cc: Koenig, Christian; Zhou, David(ChunMing); David Airlie; Daniel Vetter; Huang, Ray; Gao, Likun; Gui, Jack; [email protected]; [email protected]
Subject: [PATCH] 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.
--- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -1
@@ -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];
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx