AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: 张二东 <erdong2018@163.com>
To: amd-gfx@lists.freedesktop.org
Subject: 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock
Date: Thu, 27 Aug 2020 16:11:52 +0800 (CST)	[thread overview]
Message-ID: <5eb9e79.42da.1742ef91f76.Coremail.erdong2018@163.com> (raw)


[-- 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

             reply	other threads:[~2020-08-27 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27  8:11 张二东 [this message]
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

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=5eb9e79.42da.1742ef91f76.Coremail.erdong2018@163.com \
    --to=erdong2018@163.com \
    --cc=amd-gfx@lists.freedesktop.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