[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181013101940.GA16086@mwanda>
Date: Sat, 13 Oct 2018 13:19:40 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] perf stat: Potential NULL dereference in print_aggr()
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@...cle.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
Powered by blists - more mailing lists