[PATCH] Fix numademo segfault issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

numademo will crash if some options are added. For example, a simple
"numademo -c 20m memcpy" will cause a segmentation fault after memcpy
tests completed. 

This issue has been there for long time as I can see it in both SuSE
and RHEL distros, and 2.0.2-rc2 package.

This patch fixes the segfault by adjusting variable ac to avoid array
index overflow.

Signed-off-by: Kent Liu <kent.liu@xxxxxxxxxxxxxxx>
---
 numademo.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/numademo.c b/numademo.c
index df937d5..0dd5476 100755
--- a/numademo.c
+++ b/numademo.c
@@ -448,6 +448,7 @@ int main(int ac, char **av)
 	int simple_tests = 0;
 	
 	while (av[1] && av[1][0] == '-') { 
+		ac--;
 		switch (av[1][1]) { 
 		case 'c': 
 			delim = ","; 
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux