[dpdk-dev] [PATCH] mmap(2) returns MAP_FAILED, not NULL, on failure

Michael McConville mmcco at mykolab.com
Fri Dec 1 07:51:13 CET 2017


Signed-off-by: Michael McConville <mmcco at mykolab.com>
---
lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c
index 6ba058578..2c8a4b592 100644
--- a/lib/librte_eal/bsdapp/eal/eal_memory.c
+++ b/lib/librte_eal/bsdapp/eal/eal_memory.c
@@ -155,7 +155,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;
       }
-- 
2.15.1


More information about the dev mailing list