All of 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

* Re: 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock
  2020-08-27  8:11 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock 张二东
@ 2020-08-27 17:14 ` Tom St Denis
  2020-08-28  1:43   ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock 张二东
  0 siblings, 1 reply; 4+ messages in thread
From: Tom St Denis @ 2020-08-27 17:14 UTC (permalink / raw)
  To: 张二东; +Cc: amd-gfx mailing list


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

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: 974 bytes --]

[-- Attachment #2: 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	[flat|nested] 4+ messages in thread

* Re:Re: 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   ` 张二东
  2020-08-28 12:41     ` 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-28  1:43 UTC (permalink / raw)
  To: Tom St Denis; +Cc: amd-gfx mailing list


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

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

* Re: Re: 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock
  2020-08-28  1:43   ` 0001-Fix-a-array-bound-overflow-bug-in-function-umr_clock 张二东
@ 2020-08-28 12:41     ` Tom St Denis
  0 siblings, 0 replies; 4+ messages in thread
From: Tom St Denis @ 2020-08-28 12:41 UTC (permalink / raw)
  To: 张二东; +Cc: amd-gfx mailing list


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

Thanks, applied!

In future patches can you please add a Signed-off line (e.g. use "-s" with
git when forming the commit).

Tom

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

> 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: 2368 bytes --]

[-- Attachment #2: 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	[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 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.