eal/linuxapp: check mmap return value MAP_FAILED
PATCH 1/1 eal/linuxapp: check mmap return value MAP_FAILED
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.
--- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -0
@@ -716,6 +716,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; }
Signature · 1 line
2.9.5
PATCH v2 1/1 eal/linuxapp: check mmap return value MAP_FAILED
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.
--- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -0
@@ -716,6 +716,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; }
Signature · 1 line
2.9.5
PATCH v3 1/1 eal/linuxapp: check mmap return value MAP_FAILED
In reply to Seth HowellIf 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.
--- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -0
@@ -716,6 +716,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; }
Signature · 1 line
2.9.5
Quoted 14 lines · Seth Howell
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 <[email protected]>--- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+)lib/librte_eal/linuxapp/eal/eal_memory.c +0
-0
lib/librte_eal/linuxapp/eal/eal_memory.c create_shared_memory(const char *filename, const size_t mem_size) · line 723
Quoted 8 lines
lib/librte_eal/linuxapp/eal/eal_memory.c +2
-0@@ -716,6 +716,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; }
Thomas Monjalon
Applied29/08/2017 10:31, Sergio Gonzalez Monroy:
Quoted 8 lines · Seth Howell
Quoted 5 lines
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 <[email protected]>
Applied, thanks