From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] perf stat: Potential NULL dereference in print_aggr()
Date: Sat, 13 Oct 2018 10:19:40 +0000 [thread overview]
Message-ID: <20181013101940.GA16086@mwanda> (raw)
Smatch complains that:
./tools/perf/util/stat-display.c:616 print_aggr()
error: we previously assumed 'config->aggr_map' could be null (see line 607)
Not only that, but it looks like aggr_update_shadow() can Oops if
"config->aggr_get_id" is NULL. The intent seems to have been to return
if either of these pointers is NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
tools/perf/util/stat-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index e7b4c44ebb62..db635c01d3a3 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -604,7 +604,7 @@ static void print_aggr(struct perf_stat_config *config,
u64 ena, run, val;
bool first;
- if (!(config->aggr_map || config->aggr_get_id))
+ if (!config->aggr_map || !config->aggr_get_id)
return;
aggr_update_shadow(config, evlist);
--
2.18.0
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] perf stat: Potential NULL dereference in print_aggr()
Date: Sat, 13 Oct 2018 13:19:40 +0300 [thread overview]
Message-ID: <20181013101940.GA16086@mwanda> (raw)
Smatch complains that:
./tools/perf/util/stat-display.c:616 print_aggr()
error: we previously assumed 'config->aggr_map' could be null (see line 607)
Not only that, but it looks like aggr_update_shadow() can Oops if
"config->aggr_get_id" is NULL. The intent seems to have been to return
if either of these pointers is NULL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
tools/perf/util/stat-display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index e7b4c44ebb62..db635c01d3a3 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -604,7 +604,7 @@ static void print_aggr(struct perf_stat_config *config,
u64 ena, run, val;
bool first;
- if (!(config->aggr_map || config->aggr_get_id))
+ if (!config->aggr_map || !config->aggr_get_id)
return;
aggr_update_shadow(config, evlist);
--
2.18.0
next reply other threads:[~2018-10-13 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-13 10:19 Dan Carpenter [this message]
2018-10-13 10:19 ` [PATCH] perf stat: Potential NULL dereference in print_aggr() Dan Carpenter
2018-10-14 14:04 ` Jiri Olsa
2018-10-14 14:04 ` Jiri Olsa
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=20181013101940.GA16086@mwanda \
--to=dan.carpenter@oracle.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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.