From: Andi Kleen <ak@linux.intel.com>
To: Gaurav Singh <gaurav1086@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
"open list:PERFORMANCE EVENTS SUBSYSTEM"
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [perf] sort : Fix null pointer dereference in _hist_entry__sym_snprintf
Date: Thu, 18 Jun 2020 07:13:49 -0700 [thread overview]
Message-ID: <20200618141349.GA793265@tassilo.jf.intel.com> (raw)
In-Reply-To: <20200618003040.26360-1-gaurav1086@gmail.com>
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index d42339df20f8..25c7c96893f6 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -294,6 +294,9 @@ static int _hist_entry__sym_snprintf(struct map_symbol *ms,
> u64 ip, char level, char *bf, size_t size,
> unsigned int width)
> {
> + if (!ms)
> + return 0;
> +
> struct symbol *sym = ms->sym;
> struct map *map = ms->map;
> size_t ret = 0;
This should have given warnings because Linux and perf coding style
forbids fixed statement/declarations.
Also what's the backtrace where it is NULL? Perhaps better to fix it in
the caller.
-Andi
prev parent reply other threads:[~2020-06-18 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 0:30 [PATCH] [perf] sort : Fix null pointer dereference in _hist_entry__sym_snprintf Gaurav Singh
2020-06-18 14:13 ` Andi Kleen [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=20200618141349.GA793265@tassilo.jf.intel.com \
--to=ak@linux.intel.com \
--cc=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 \
--cc=ravi.bangoria@linux.ibm.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