linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Holasek <pholasek@redhat.com>
To: cpw@sgi.com
Cc: linux-numa@vger.kernel.org
Subject: [PATCH] numademo: msize check for ptrchase test
Date: Thu, 16 Feb 2012 08:54:25 -0500 (EST)	[thread overview]
Message-ID: <a5bced8f-f66d-4d15-a743-147b95393d00@zmail17.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <d2a80b30-6855-47b7-a8e1-57bb3f1c5268@zmail17.collab.prod.int.phx2.redhat.com>

From: Petr Holasek <pholasek@redhat.com>

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

       reply	other threads:[~2012-02-16 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d2a80b30-6855-47b7-a8e1-57bb3f1c5268@zmail17.collab.prod.int.phx2.redhat.com>
2012-02-16 13:54 ` Petr Holasek [this message]
2012-02-16 15:21   ` [PATCH] numademo: msize check for ptrchase test Cliff Wickman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5bced8f-f66d-4d15-a743-147b95393d00@zmail17.collab.prod.int.phx2.redhat.com \
    --to=pholasek@redhat.com \
    --cc=cpw@sgi.com \
    --cc=linux-numa@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).