Skip to contentSkip to conversation

perf top: Fix annotate segv

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Jan 12, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  cc841580aa58ad7498b23e282859d07f8b721e24
Gitweb:     http://git.kernel.org/tip/cc841580aa58ad7498b23e282859d07f8b721e24
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 11 Jan 2011 15:16:52 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 11 Jan 2011 16:56:16 -0200

perf top: Fix annotate segv

Before we had sym_counter, it was initialized to zero and we used that as an index in the global attrs variable, now we have a list of evsel entries, and sym_counter became sym_evsel, that remained initialized to zero (NULL): b00m.

Fix it by initializing it to the first entry in the evsel list.

Bug-introduced: 69aad6f

Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Kirill Smelkov <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Tom Zanussi <[email protected]>

LKML-Reference: <new-submission>

---
 tools/perf/builtin-top.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +2 -0
index 4b995ee..568b195 100644
@@ -1473,6 +1473,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 		pos->attr.sample_period = default_interval;
 	}
 
+	sym_evsel = list_entry(evsel_list.next, struct perf_evsel, node);
+
 	symbol_conf.priv_size = (sizeof(struct sym_entry) +
 				 (nr_counters + 1) * sizeof(unsigned long));