The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/amd/powerplay: Fix an off by one in navi10_get_smu_msg_index()
@ 2019-08-26 13:20 Dan Carpenter
  2019-08-26 15:16 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-08-26 13:20 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Christian König, David (ChunMing) Zhou, David Airlie,
	Daniel Vetter, Kevin Wang, Huang Rui, Kenneth Feng, Evan Quan,
	amd-gfx, linux-kernel, kernel-janitors

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 <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index d7e25f5113f1..fbecd25f150f 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-26 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-26 13:20 [PATCH] drm/amd/powerplay: Fix an off by one in navi10_get_smu_msg_index() Dan Carpenter
2019-08-26 15:16 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox