Date:	Thu, 16 Feb 2012 08:54:25 -0500 (EST)
From: Petr Holasek <pholasek@redhat.com>
To: cpw@sgi.com
Cc: linux-numa@vger.kernel.org
Subject: [PATCH] numademo: msize check for ptrchase test

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++) {
