From: Michael McConville Date: Fri, 1 Dec 2017 06:51:13 +0000 (-0700) Subject: mem: fix mmap error check on huge page attach X-Git-Tag: spdx-start~757 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b45056be0429d6df2313e5e49aa8f78e5d840a97;p=dpdk.git mem: fix mmap error check on huge page attach mmap(2) returns MAP_FAILED, not NULL, on failure. Signed-off-by: Michael McConville Reviewed-by: Ferruh Yigit --- diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 45b198fd7f..bdfb882818 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -126,7 +126,7 @@ rte_eal_hugepage_attach(void) /* Map the shared hugepage_info into the process address spaces */ hpi = mmap(NULL, sizeof(struct hugepage_info), PROT_READ, MAP_PRIVATE, fd_hugepage_info, 0); - if (hpi == NULL) { + if (hpi == MAP_FAILED) { RTE_LOG(ERR, EAL, "Could not mmap %s\n", eal_hugepage_info_path()); goto error; }