linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Holasek <pholasek@redhat.com>
To: linux-numa@vger.kernel.org
Cc: cpw@sgi.com
Subject: [PATCH] libnuma: checking of sucessfull allocations in numademo
Date: Thu, 18 Aug 2011 07:01:33 -0400 (EDT)	[thread overview]
Message-ID: <1777371722.2768004.1313665293333.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <193444186.2767974.1313665001288.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>

From: Petr Holasek <pholasek@redhat.com>

This patch is based on BZ 
https://bugzilla.redhat.com/show_bug.cgi?id=707138
where too big argument for numademo caused segfault.

Only simple check of returned pointer from numa_alloc*
calls was added.

Signed-off-by: Petr Holasek <pholasek@redhat.com>

--
diff -up numactl-2.0.7/numademo.c.origin numactl-2.0.7/numademo.c
--- numactl-2.0.7/numademo.c.origin	2011-08-18 06:40:56.617884667 -0400
+++ numactl-2.0.7/numademo.c	2011-08-18 06:38:15.783759565 -0400
@@ -156,6 +156,11 @@ void memtest(char *name, unsigned char *
 	int i;
 	char title[128], result[128];
 
+	if (!mem) {
+		fprintf(stderr,"Failed to allocate %lu bytes of memory. Test \"%s\" exits.\n", msize, name);
+		return;
+	}
+
 #ifdef HAVE_STREAM_LIB
 	if (thistest == STREAM) {
 		do_stream(name, mem);

       reply	other threads:[~2011-08-18 11:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <193444186.2767974.1313665001288.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2011-08-18 11:01 ` Petr Holasek [this message]
2011-08-18 12:01   ` [PATCH] libnuma: checking of sucessfull allocations in numademo 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=1777371722.2768004.1313665293333.JavaMail.root@zmail04.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).