AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: 张二东 <erdong2018@163.com>
To: "Tom St Denis" <tstdenis82@gmail.com>
Cc: amd-gfx mailing list <amd-gfx@lists.freedesktop.org>
Subject: Re:Re: 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock
Date: Fri, 28 Aug 2020 09:43:18 +0800 (CST)	[thread overview]
Message-ID: <3ffa3550.11d0.17432bbbc3a.Coremail.erdong2018@163.com> (raw)
In-Reply-To: <CAAzXoRJ+S6qaE_UaN0gNtkHPQcp+toMcUA1-8fLhU37rDdHyRQ@mail.gmail.com>


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

Yes, you are right. New patch is in attachment.


thanks.
















在 2020-08-28 01:14:02,"Tom St Denis" <tstdenis82@gmail.com> 写道:

isn't a better fix to simply delete the line?  The print seems redundant to me.


Tom


On Thu, Aug 27, 2020 at 9:27 AM 张二东 <erdong2018@163.com> wrote:









 

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

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

[-- Attachment #2: 0001-Delete-redundant-print-info-to-reslove-a-array-bound.patch --]
[-- Type: application/octet-stream, Size: 1032 bytes --]

From e65ac007e4af51a0bff5a9d44f4cef74b315d288 Mon Sep 17 00:00:00 2001
From: Erdong zhang <erdong2018@163.com>
Date: Fri, 28 Aug 2020 09:33:12 +0800
Subject: [PATCH]     Delete redundant print info to reslove a array bound
 overflow issue in 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app/clock.c b/src/app/clock.c
index 101da6f..70b3e0b 100644
--- a/src/app/clock.c
+++ b/src/app/clock.c
@@ -117,7 +117,9 @@ 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)
+			printf("[ERROR]: Maybe wrong clock name or not support so far!\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-28  7:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` 张二东 [this message]
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=3ffa3550.11d0.17432bbbc3a.Coremail.erdong2018@163.com \
    --to=erdong2018@163.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=tstdenis82@gmail.com \
    /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