[PATCH] numademo: msize check for ptrchase test

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

 



From: Petr Holasek <pholasek@xxxxxxxxxx>

This patch fixes ptrchase test segfault, when numademo is 
called with argument lower than sizeof(struct union node) 
(8 bytes on x86_64).

--
diff -up numactl-2.0.8-rc3/numademo.c.orig numactl-2.0.8-rc3/numademo.c
--- numactl-2.0.8-rc3/numademo.c.orig	2011-12-19 15:51:35.000000000 +0100
+++ numactl-2.0.8-rc3/numademo.c	2012-02-16 14:44:34.510249987 +0100
@@ -529,7 +529,13 @@ int main(int ac, char **av)
 #ifdef HAVE_STREAM_LIB
 		test(STREAM);
 #endif
-		test(PTRCHASE);
+		if (msize >= sizeof(union node)) {
+			test(PTRCHASE);
+		} else {
+			fprintf(stderr, "You must set msize at least %lu bytes for ptrchase test.\n",
+				sizeof(union node));
+			exit(1);
+		}
 	} else {
 		int k;
 		for (k = 2; k < ac; k++) {
--
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