AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock
@ 2020-08-27  8:11 张二东
  2020-08-27 17:14 ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock Tom St Denis
  0 siblings, 1 reply; 4+ messages in thread
From: 张二东 @ 2020-08-27  8:11 UTC (permalink / raw)
  To: amd-gfx


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



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

[-- Attachment #2: 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock.patch --]
[-- Type: application/octet-stream, Size: 1037 bytes --]

From ba05bc0f7fa5f8dbc8998384bb713a2a69be58b9 Mon Sep 17 00:00:00 2001
From: Erdong zhang <erdong2018@163.com>
Date: Thu, 27 Aug 2020 15:40:13 +0800
Subject: [PATCH]     Fix a array bound overflow bug in function
 umr_clock_manual

    If i input a wrong clock name or a name not exist in asic_clocks when use umr set clock,
the function umr_clock_manual try to access array asic_clocks.clock[i] with index UMR_CLOCK_MAX,
final the umr encounter a egmentation fault.
---
 src/app/clock.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/app/clock.c b/src/app/clock.c
index 101da6f..8818918 100644
--- a/src/app/clock.c
+++ b/src/app/clock.c
@@ -117,7 +117,11 @@ void umr_clock_manual(struct umr_asic *asic, const char* clock_name, void* value
 				break;
 			}
 		}
-		print_clock(asic_clocks.clocks[i], asic);
+
+		if(i < UMR_CLOCK_MAX)
+			print_clock(asic_clocks.clocks[i], asic);
+		else
+			printf("[ERROR]: Maybe wrong clock name!\n");
 	} else {
 		printf("[ERROR]: Invalid input!\n");
 	}
-- 
2.17.1


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]

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

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

end of thread, other threads:[~2020-08-28 12:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27  8:11 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock 张二东
2020-08-27 17:14 ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock Tom St Denis
2020-08-28  1:43   ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock 张二东
2020-08-28 12:41     ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock Tom St Denis

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