2079c3
From cd7c78e77dc43fff5dbe2763f1ac83a8b4a6b1c7 Mon Sep 17 00:00:00 2001
2079c3
From: Harish <harish@linux.vnet.ibm.com>
2079c3
Date: Thu, 21 Jun 2018 07:53:10 +0530
2079c3
Subject: [PATCH 1/7] Fix: node_list with memory-less nodes
2079c3
2079c3
Patch adds check to avoid memory-less nodes while traversing till
2079c3
max node, and this also prevents nodes_to_use sysmalloc failure as
2079c3
nodes_to_use is malloc'ed with numa_num_configured_nodes which
2079c3
returns the number of nodes configured with memory.
2079c3
2079c3
Signed-off-by: Harish <harish@linux.vnet.ibm.com>
2079c3
Signed-off-by: Pingfan Liu <piliu@redhat.com>
2079c3
---
2079c3
 numademo.c | 2 +-
2079c3
 1 file changed, 1 insertion(+), 1 deletion(-)
2079c3
2079c3
diff --git a/numademo.c b/numademo.c
2079c3
index b01e995..90d8e84 100644
2079c3
--- a/numademo.c
2079c3
+++ b/numademo.c
2079c3
@@ -307,7 +307,7 @@ void get_node_list()
2079c3
         node_to_use = (int *)malloc(numnodes * sizeof(int));
2079c3
         max_node = numa_max_node();
2079c3
         for (a = 0; a <= max_node; a++) {
2079c3
-                if(numa_node_size(a, &free_node_sizes) != -1)
2079c3
+                if (numa_node_size(a, &free_node_sizes) > 0)
2079c3
                         node_to_use[got_nodes++] = a;
2079c3
         }
2079c3
 }
2079c3
-- 
2079c3
2.7.4
2079c3