* [PATCH] drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
@ 2019-03-21 9:19 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2019-03-21 9:19 UTC (permalink / raw)
To: Alex Deucher, Kevin Wang
Cc: David (ChunMing) Zhou, Chengming Gui, David Airlie,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Huang Rui,
Daniel Vetter, Likun Gao, Christian König
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@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];
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-21 9:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-21 9:19 [PATCH] drm/amd/powerplay: Off by one in vega20_get_smu_msg_index() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox