linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Vincent Donnefort <vincent.donnefort@arm.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] trace-cmd: Fix mmap error path in allocate_page_map()
Date: Wed, 10 Mar 2021 12:16:39 -0500	[thread overview]
Message-ID: <20210310121639.644d04d5@gandalf.local.home> (raw)
In-Reply-To: <20210310152730.3661-1-vincent.donnefort@arm.com>

On Wed, 10 Mar 2021 15:27:30 +0000
Vincent Donnefort <vincent.donnefort@arm.com> wrote:

> 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) {

Ouch. Nice catch!

I'll apply it to my next push to the tree.

-- Steve

      reply	other threads:[~2021-03-10 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 15:27 [PATCH] trace-cmd: Fix mmap error path in allocate_page_map() Vincent Donnefort
2021-03-10 17:16 ` Steven Rostedt [this message]

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=20210310121639.644d04d5@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=vincent.donnefort@arm.com \
    /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).