mem: fix division by zero in no-NUMA mode
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 26 Nov 2018 10:57:03 +0000 (10:57 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 26 Nov 2018 14:35:46 +0000 (15:35 +0100)
commite45088b1e1972280427528cc055dfdfdec0ed1c3
tree23b5dfcad7d2a119c968cc711d4aafba3e35ff2d
parent6cff3183c2035fe90e18e59c1ea3c0304116a4de
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: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: David Hunt <david.hunt@intel.com>
lib/librte_eal/linuxapp/eal/eal_memory.c