[PATCH] drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
Wang, Kevin(Yang)
Kevin1.Wang at amd.com
Thu Mar 21 09:37:05 UTC 2019
________________________________
From: Dan Carpenter <dan.carpenter at oracle.com>
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; amd-gfx at lists.freedesktop.org; kernel-janitors at vger.kernel.org
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.
Fixes: 3ec3c931489f ("drm/amd/powerplay: implement smu vega20_message_map for vega20")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 7e9e8ad9a300..31cd7b9d4dad 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -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];
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
--
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190321/e32394c0/attachment.html>
More information about the amd-gfx
mailing list