All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/powerplay: fix off-by-one array bounds check
@ 2019-06-28 14:24 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2019-06-28 14:24 UTC (permalink / raw)
  To: Rex Zhu, Evan Quan, Alex Deucher, Christian König,
	David Zhou, David Airlie, Daniel Vetter, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.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@canonical.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


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

* [PATCH] drm/amd/powerplay: fix off-by-one array bounds check
@ 2019-06-28 14:24 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2019-06-28 14:24 UTC (permalink / raw)
  To: Rex Zhu, Evan Quan, Alex Deucher, Christian König,
	David Zhou, David Airlie, Daniel Vetter, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.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@canonical.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

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

* [PATCH] drm/amd/powerplay: fix off-by-one array bounds check
@ 2019-06-28 14:24 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2019-06-28 14:24 UTC (permalink / raw)
  To: Rex Zhu, Evan Quan, Alex Deucher, Christian König,
	David Zhou, David Airlie, Daniel Vetter, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.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@canonical.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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/amd/powerplay: fix off-by-one array bounds check
  2019-06-28 14:24 ` Colin King
  (?)
  (?)
@ 2019-06-28 15:15 ` Abramov, Slava
  -1 siblings, 0 replies; 4+ messages in thread
From: Abramov, Slava @ 2019-06-28 15:15 UTC (permalink / raw)
  To: Colin King, Rex Zhu, Quan, Evan, Deucher, Alexander, Koenig,
	Christian, Zhou, David(ChunMing),
	David Airlie, Daniel Vetter, amd-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1752 bytes --]

Acked-by: Slava Abramov <slava.abramov@amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Colin King <colin.king@canonical.com>
Sent: Friday, June 28, 2019 10:24:02 AM
To: Rex Zhu; Quan, Evan; Deucher, Alexander; Koenig, Christian; Zhou, David(ChunMing); David Airlie; Daniel Vetter; amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix off-by-one array bounds check

From: Colin Ian King <colin.king@canonical.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@canonical.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

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 3129 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-28 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28 14:24 [PATCH] drm/amd/powerplay: fix off-by-one array bounds check Colin King
2019-06-28 14:24 ` Colin King
2019-06-28 14:24 ` Colin King
2019-06-28 15:15 ` Abramov, Slava

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.