From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
Kevin Wang <Kevin1.Wang-5C7GfCeVMHo@public.gmane.org>
Cc: "David (ChunMing) Zhou"
<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
"Chengming Gui" <Jack.Gui-5C7GfCeVMHo@public.gmane.org>,
"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
"Huang Rui" <ray.huang-5C7GfCeVMHo@public.gmane.org>,
"Daniel Vetter" <daniel-/w4YWyX8dFk@public.gmane.org>,
"Likun Gao" <Likun.Gao-5C7GfCeVMHo@public.gmane.org>,
"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH] drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
Date: Thu, 21 Mar 2019 09:19:57 +0000 [thread overview]
Message-ID: <20190321091957.GA2793@kadam> (raw)
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
reply other threads:[~2019-03-21 9:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190321091957.GA2793@kadam \
--to=dan.carpenter@oracle.com \
--cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
--cc=Jack.Gui-5C7GfCeVMHo@public.gmane.org \
--cc=Kevin1.Wang-5C7GfCeVMHo@public.gmane.org \
--cc=Likun.Gao-5C7GfCeVMHo@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ray.huang-5C7GfCeVMHo@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox