From dd61b34d580b4279a0c6c5f22304038ec44193ba Mon Sep 17 00:00:00 2001 From: Intel Date: Tue, 12 Mar 2013 12:03:00 +0100 Subject: [PATCH] mem: error if requesting more segments than MAX_MEMSEG Signed-off-by: Intel --- lib/librte_eal/linuxapp/eal/eal_memory.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 6a91f35f2a..ec43cdc386 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -970,6 +970,18 @@ rte_eal_hugepage_init(void) hugepage[i].memseg_id = j; } + if (i < nrpages) { + RTE_LOG(ERR, EAL, "Can only reserve %d pages " + "from %d requested\n" + "Current %s=%d is not enough\n" + "Please either increase it or request less amount " + "of memory.\n", + i, nrpages, RTE_STR(CONFIG_RTE_MAX_MEMSEG), + RTE_MAX_MEMSEG); + return (-ENOMEM); + } + + return 0; -- 2.20.1