git.droids-corp.org
/
dpdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
41baec5
)
mem: check mmap failure
author
Seth Howell
<seth.howell@intel.com>
Mon, 28 Aug 2017 21:49:12 +0000
(14:49 -0700)
committer
Thomas Monjalon
<thomas@monjalon.net>
Mon, 9 Oct 2017 21:17:04 +0000
(23:17 +0200)
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 <seth.howell@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
lib/librte_eal/linuxapp/eal/eal_memory.c
patch
|
blob
|
history
diff --git
a/lib/librte_eal/linuxapp/eal/eal_memory.c
b/lib/librte_eal/linuxapp/eal/eal_memory.c
index
e2ea120
..
28bca49
100644
(file)
--- 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;
}