SHA256
1
0
forked from pool/numactl
numactl/numactl_fix_mem_corrup_numa_init.patch

29 lines
844 B
Diff
Raw Normal View History

From: Jan Beulich <jbeulich@suse.de>
---
libnuma.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Index: numactl-2.0.4-rc2/libnuma.c
===================================================================
--- numactl-2.0.4-rc2.orig/libnuma.c
+++ numactl-2.0.4-rc2/libnuma.c
@@ -461,10 +461,13 @@ set_task_constraints(void)
read_mask(mask, numa_all_nodes_ptr);
}
if (strncmp(buffer,"Mems_allowed_list:",18) == 0) {
- nodes_allowed_list = malloc(strlen(buffer)-18);
- strncpy(nodes_allowed_list, buffer + 19,
- strlen(buffer) - 19);
- nodes_allowed_list[strlen(nodes_allowed_list)-1] = '\0';
+ size_t len = strlen(mask);
+
+ nodes_allowed_list = malloc(len);
+ if (nodes_allowed_list) {
+ memcpy(nodes_allowed_list, mask, len-1);
+ nodes_allowed_list[len-1] = '\0';
+ }
}
}
fclose(f);