From: Vincent Donnefort <vincent.donnefort@arm.com>
To: linux-trace-devel@vger.kernel.org
Cc: Vincent Donnefort <vincent.donnefort@arm.com>
Subject: [PATCH] trace-cmd: Fix mmap error path in allocate_page_map()
Date: Wed, 10 Mar 2021 15:27:30 +0000 [thread overview]
Message-ID: <20210310152730.3661-1-vincent.donnefort@arm.com> (raw)
A typo in allocate_page_map() led to not testing mmap failure and using
the defunct pointer as a valid one.
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index f9d09d2..2093a3d 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1004,7 +1004,7 @@ static void *allocate_page_map(struct tracecmd_input *handle,
page_map->map = mmap(NULL, map_size, PROT_READ, MAP_PRIVATE,
handle->fd, map_offset);
- if (page->map == MAP_FAILED) {
+ if (page_map->map == MAP_FAILED) {
/* Try a smaller map */
map_size >>= 1;
if (map_size < handle->page_size) {
--
2.27.0
next reply other threads:[~2021-03-10 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 15:27 Vincent Donnefort [this message]
2021-03-10 17:16 ` [PATCH] trace-cmd: Fix mmap error path in allocate_page_map() Steven Rostedt
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=20210310152730.3661-1-vincent.donnefort@arm.com \
--to=vincent.donnefort@arm.com \
--cc=linux-trace-devel@vger.kernel.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).