[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190628142402.2771-1-colin.king@canonical.com>
Date: Fri, 28 Jun 2019 15:24:02 +0100
From: Colin King <colin.king@...onical.com>
To: Rex Zhu <rex.zhu@....com>, Evan Quan <evan.quan@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Zhou <David1.Zhou@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix off-by-one array bounds check
From: Colin Ian King <colin.king@...onical.com>
The array bounds check for index is currently off-by-one and should
be using >= rather than > on the upper bound. Fix this.
Addresses-Coverity: ("Out-of-bounds read")
Fixes: b3490673f905 ("drm/amd/powerplay: introduce the navi10 pptable implementation")
Signed-off-by: Colin Ian King <colin.king@...onical.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 27e5c80..f678700 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -210,7 +210,7 @@ static int navi10_workload_map[] = {
static int navi10_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 = navi10_message_map[index];
--
2.7.4
Powered by blists - more mailing lists