Skip to contentSkip to conversation

perf hists: hist_entry__cmp() may use he_tmp.hists, initialize it

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Aug 12, 2015 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  5cef897652f224442c013d9e9425536b38385351
Gitweb:     http://git.kernel.org/tip/5cef897652f224442c013d9e9425536b38385351
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Mon, 10 Aug 2015 15:45:55 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 10 Aug 2015 17:01:00 -0300

perf hists: hist_entry__cmp() may use he_tmp.hists, initialize it

The iter_add_next_cumulative_entry() function calls hist_entry__cmp(), which may want to access the hists where this hist_entry is stored, initialize it to let that happen and avoid segfaults.

Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/util/hist.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/hist.c +1 -0
index a6e9ddd..2fe6ea3 100644
@@ -761,6 +761,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
 	struct hist_entry **he_cache = iter->priv;
 	struct hist_entry *he;
 	struct hist_entry he_tmp = {
+		.hists = evsel__hists(evsel),
 		.cpu = al->cpu,
 		.thread = al->thread,
 		.comm = thread__comm(al->thread),