* [dpdk-dev] [PATCH] eal/linuxapp: check mmap return value MAP_FAILED
@ 2017-08-15 20:53 Seth Howell
2017-08-28 21:46 ` [dpdk-dev] [PATCH v2] " Seth Howell
2017-08-28 21:49 ` [dpdk-dev] [PATCH v3] " Seth Howell
0 siblings, 2 replies; 5+ messages in thread
From: Seth Howell @ 2017-08-15 20:53 UTC (permalink / raw)
To: dev; +Cc: 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 <seth.howell@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5279128..ba76b02 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -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;
}
--
2.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] eal/linuxapp: check mmap return value MAP_FAILED
2017-08-15 20:53 [dpdk-dev] [PATCH] eal/linuxapp: check mmap return value MAP_FAILED Seth Howell
@ 2017-08-28 21:46 ` Seth Howell
2017-08-28 21:49 ` [dpdk-dev] [PATCH v3] " Seth Howell
1 sibling, 0 replies; 5+ messages in thread
From: Seth Howell @ 2017-08-28 21:46 UTC (permalink / raw)
To: dev; +Cc: 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 <seth.howell@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5279128..ba76b02 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -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;
}
--
2.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v3] eal/linuxapp: check mmap return value MAP_FAILED
2017-08-15 20:53 [dpdk-dev] [PATCH] eal/linuxapp: check mmap return value MAP_FAILED Seth Howell
2017-08-28 21:46 ` [dpdk-dev] [PATCH v2] " Seth Howell
@ 2017-08-28 21:49 ` Seth Howell
2017-08-29 8:31 ` Sergio Gonzalez Monroy
1 sibling, 1 reply; 5+ messages in thread
From: Seth Howell @ 2017-08-28 21:49 UTC (permalink / raw)
To: dev; +Cc: 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 <seth.howell@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index 5279128..63fec29 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -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;
}
--
2.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v3] eal/linuxapp: check mmap return value MAP_FAILED
2017-08-28 21:49 ` [dpdk-dev] [PATCH v3] " Seth Howell
@ 2017-08-29 8:31 ` Sergio Gonzalez Monroy
2017-10-09 21:18 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: Sergio Gonzalez Monroy @ 2017-08-29 8:31 UTC (permalink / raw)
To: Seth Howell, dev
On 28/08/2017 22:49, Seth Howell wrote:
> 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>
> ---
> lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 5279128..63fec29 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -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;
> }
>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v3] eal/linuxapp: check mmap return value MAP_FAILED
2017-08-29 8:31 ` Sergio Gonzalez Monroy
@ 2017-10-09 21:18 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-10-09 21:18 UTC (permalink / raw)
To: Seth Howell; +Cc: dev, Sergio Gonzalez Monroy
29/08/2017 10:31, Sergio Gonzalez Monroy:
> On 28/08/2017 22:49, Seth Howell wrote:
> > 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>
Applied, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-09 21:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-15 20:53 [dpdk-dev] [PATCH] eal/linuxapp: check mmap return value MAP_FAILED Seth Howell
2017-08-28 21:46 ` [dpdk-dev] [PATCH v2] " Seth Howell
2017-08-28 21:49 ` [dpdk-dev] [PATCH v3] " Seth Howell
2017-08-29 8:31 ` Sergio Gonzalez Monroy
2017-10-09 21:18 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).