From: Seth Howell <seth.howell@intel.com>
To: dev@dpdk.org
Cc: Seth Howell <seth.howell@intel.com>
Subject: [dpdk-dev] [PATCH] eal/linuxapp: check mmap return value MAP_FAILED
Date: Tue, 15 Aug 2017 13:53:36 -0700 [thread overview]
Message-ID: <20170815205336.9266-1-seth.howell@intel.com> (raw)
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
next reply other threads:[~2017-08-15 20:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 20:53 Seth Howell [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170815205336.9266-1-seth.howell@intel.com \
--to=seth.howell@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).