From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: gaurav singh <gaurav1086@gmail.com>
Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@redhat.com,
namhyung@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix null pointer dereference in hists__fprintf_nr_sample_events
Date: Mon, 8 Jun 2020 13:17:16 -0300 [thread overview]
Message-ID: <20200608161716.GB3073@kernel.org> (raw)
In-Reply-To: <CAFAFadADkyJ4qn8Ax2Ratnw03jHiTqY1pvj=AU6kwaqGDNkdfA@mail.gmail.com>
Em Sat, Jun 06, 2020 at 06:44:45PM -0400, gaurav singh escreveu:
> Hi,
>
> evname is assigned if condition (evsel__is_group_event(evsel)) is true . It
> is checked for nullnuess here:
>
> if (evname != NULL) {
> ret += fprintf(fp, " of event%s '%s'",
> evsel->core.nr_members > 1 ? "s" : "", evname);
> }
>
> and later on its used directly : strstr(evname, "call-graph=no")) which can
> possibly cause null pointer dereference. In order to fix this, add an an
> extra check in the if.
>
> Please find the patch below.
>
> Thanks and regards,
> Gaurav.
I'm applying the patch by hand, your e-mail client garbled it, I'm also
adding:
Cc: Kan Liang <kan.liang@intel.com>
Fixes: 9e207ddfa207 ("perf report: Show call graph from reference events")
Thanks,
- Arnaldo
>
> From 399b3faaa5283a488f4227a13d69255e0f316d94 Mon Sep 17 00:00:00 2001
> From: Gaurav Singh <gaurav1086@gmail.com>
> Date: Sat, 6 Jun 2020 18:37:17 -0400
> Subject: [PATCH] Fix null pointer dereference in
> hists__fprintf_nr_sample_events
>
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> ---
> tools/perf/builtin-report.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index b63b3fb2de70..d8a45c28ba53 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -478,7 +478,7 @@ static size_t hists__fprintf_nr_sample_events(struct
> hists *hists, struct report
> if (rep->time_str)
> ret += fprintf(fp, " (time slices: %s)", rep->time_str);
>
> - if (symbol_conf.show_ref_callgraph &&
> + if (symbol_conf.show_ref_callgraph && evname != NULL &&
> strstr(evname, "call-graph=no")) {
> ret += fprintf(fp, ", show reference callgraph");
> }
> --
> 2.17.1
--
- Arnaldo
parent reply other threads:[~2020-06-08 16:17 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <CAFAFadADkyJ4qn8Ax2Ratnw03jHiTqY1pvj=AU6kwaqGDNkdfA@mail.gmail.com>]
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=20200608161716.GB3073@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=gaurav1086@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.