[PATCH] libnuma: checking of sucessfull allocations in numademo

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

 



From: Petr Holasek <pholasek@xxxxxxxxxx>

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@xxxxxxxxxx>

--
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);
--
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