[PATCH] numademo: msize check for ptrchase test
Petr Holasek <[email protected]> Thu, 16 Feb 2012 08:54:25 -0500 (EST)
| Newsgroups | org.kernel.vger.linux-numa |
|---|---|
| Message-ID | <a5bced8f-f66d-4d15-a743-147b95393d00@zmail17.collab.prod.int.phx2.redhat.com> |
From: Petr Holasek <[email protected]> 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++) {