From: Stanislav K. <sta...@or...> - 2013-08-21 11:55:23
|
Now nodemask_size is rounded up to the next multiple of sizeof(nodemask_t). Signed-off-by: Stanislav Kholmanskikh <sta...@or...> --- testcases/kernel/lib/numa_helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c index 4157816..9151583 100644 --- a/testcases/kernel/lib/numa_helper.c +++ b/testcases/kernel/lib/numa_helper.c @@ -60,7 +60,7 @@ unsigned long get_max_node(void) #if HAVE_NUMA_H static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node) { - unsigned long nodemask_size = max_node / 8 + 1; + unsigned long nodemask_size = ALIGN(max_node, sizeof(nodemask_t)*8) / 8; int i; char fn[64]; struct stat st; @@ -76,7 +76,7 @@ static void get_nodemask_allnodes(nodemask_t * nodemask, unsigned long max_node) static int filter_nodemask_mem(nodemask_t * nodemask, unsigned long max_node) { #if MPOL_F_MEMS_ALLOWED - unsigned long nodemask_size = max_node / 8 + 1; + unsigned long nodemask_size = ALIGN(max_node, sizeof(nodemask_t)*8) / 8; memset(nodemask, 0, nodemask_size); /* * avoid numa_get_mems_allowed(), because of bug in getpol() @@ -165,7 +165,7 @@ int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes) #if HAVE_NUMA_H unsigned long max_node = get_max_node(); - unsigned long nodemask_size = max_node / 8 + 1; + unsigned long nodemask_size = ALIGN(max_node, sizeof(nodemask_t)*8) / 8; nodemask = malloc(nodemask_size); if (nodes) -- 1.7.1 |