From: Seth Howell Date: Mon, 28 Aug 2017 21:49:12 +0000 (-0700) Subject: mem: check mmap failure X-Git-Tag: spdx-start~1678 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7485e06c2afb6baba38ce03228638aed8d903c62;p=dpdk.git mem: check mmap failure If mmap fails, it will return the value MAP_FAILED. Checking for this return code allows us to properly identify mmap failures and report them as such to the calling function. Signed-off-by: Seth Howell Acked-by: Sergio Gonzalez Monroy --- diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index e2ea120d2e..28bca49520 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -685,6 +685,8 @@ create_shared_memory(const char *filename, const size_t mem_size) } retval = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); + if (retval == MAP_FAILED) + return NULL; return retval; }