[PATCH] numactl: checks for numa when showing hardware

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

 



Checks if NUMA is available before printing hardware,
otherwise segfault occurs.

Signed-off-by: Elena Ufimtseva <ufimtseva@xxxxxxxxx>
---
 numactl.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/numactl.c b/numactl.c
index 97955a4..f30b53c 100755
--- a/numactl.c
+++ b/numactl.c
@@ -242,6 +242,11 @@ void hardware(void)
 	int prevnode=-1;
 	int skip=0;
 	int maxnode = numa_max_node();
+	
+	if (numa_available() < 0) {
+                printf("No NUMA available on this system\n");
+                exit(1);
+        }
 
 	for (i=0; i<=maxnode; i++)
 		if (numa_bitmask_isbitset(numa_nodes_ptr, i))
-- 
1.7.2.5

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