path: root/lib/librte_eal/linuxapp/eal/eal_memory.c
diff options
authorAnatoly Burakov <>2018-11-26 10:57:03 +0000
committerThomas Monjalon <>2018-11-26 15:35:46 +0100
commite45088b1e1972280427528cc055dfdfdec0ed1c3 (patch)
tree23b5dfcad7d2a119c968cc711d4aafba3e35ff2d /lib/librte_eal/linuxapp/eal/eal_memory.c
parent6cff3183c2035fe90e18e59c1ea3c0304116a4de (diff)
mem: fix division by zero in no-NUMA mode
When RTE_EAL_NUMA_AWARE_HUGEPAGES is set to "n", not all memtypes will be valid, because we skip some due to not supporting other NUMA nodes, leading to a division by zero error down the line because the necessary memtype fields weren't populated. Fix it by limiting number of memtypes to number of memtypes we have actually created. Fixes: 1dd342d0fdc4 ("mem: improve segment list preallocation") Cc: Signed-off-by: Anatoly Burakov <> Tested-by: David Hunt <>
Diffstat (limited to 'lib/librte_eal/linuxapp/eal/eal_memory.c')
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 6f94621..32feb41 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -2230,6 +2230,8 @@ memseg_primary_init(void)
socket_id, hugepage_sz);
+ /* number of memtypes could have been lower due to no NUMA support */
+ n_memtypes = cur_type;
/* set up limits for types */
max_mem = (uint64_t)RTE_MAX_MEM_MB << 20;