public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf callchain: Fix segfault in thread__resolve_callchain_sample()
Date: Thu, 14 Nov 2019 16:13:35 -0300	[thread overview]
Message-ID: <20191114191335.GA24290@kernel.org> (raw)
In-Reply-To: <20191114142538.4097-1-adrian.hunter@intel.com>

Em Thu, Nov 14, 2019 at 04:25:38PM +0200, Adrian Hunter escreveu:
> Do not dereference 'chain' when it is NULL.
> 
>   $ perf record -e intel_pt//u -e branch-misses:u uname
>   $ perf report --itrace=l --branch-history
>   perf: Segmentation fault

Thanks, tested and applied.

- Arnaldo
 
> Fixes: e9024d519d89 ("perf callchain: Honour the ordering of PERF_CONTEXT_{USER,KERNEL,etc}")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  tools/perf/util/machine.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 6a0f5c25ce3e..0a21ab69a247 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2414,7 +2414,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
>  	}
>  
>  check_calls:
> -	if (callchain_param.order != ORDER_CALLEE) {
> +	if (chain && callchain_param.order != ORDER_CALLEE) {
>  		err = find_prev_cpumode(chain, thread, cursor, parent, root_al,
>  					&cpumode, chain->nr - first_call);
>  		if (err)
> -- 
> 2.17.1

-- 

- Arnaldo

  reply	other threads:[~2019-11-14 19:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 14:25 [PATCH] perf callchain: Fix segfault in thread__resolve_callchain_sample() Adrian Hunter
2019-11-14 19:13 ` Arnaldo Carvalho de Melo [this message]
2019-11-19 16:56 ` [tip: perf/core] " tip-bot2 for Adrian Hunter

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=20191114191335.GA24290@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@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