aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-02-09 10:56:28 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-02-16 11:47:55 -0500
commit289c082044643e55f65c6a16bb3621cf3f35a454 (patch)
tree5d4f1bcd70435e16bc0cd57b824d50c25290d972 /tools
parent5c35d69fb60b1dc49595f5b9a2c7158283e9eaf3 (diff)
perf annotate: Check if offset is less than symbol size
Just like done on symbol__inc_addr_samples to catch misparsed offsets from objdump. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/annotate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 02976b895f27..70ec422ddb64 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -541,11 +541,12 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
541 struct annotation *notes = symbol__annotation(sym); 541 struct annotation *notes = symbol__annotation(sym);
542 struct sym_hist *h = annotation__histogram(notes, evidx); 542 struct sym_hist *h = annotation__histogram(notes, evidx);
543 struct objdump_line *pos; 543 struct objdump_line *pos;
544 int len = sym->end - sym->start;
544 545
545 h->sum = 0; 546 h->sum = 0;
546 547
547 list_for_each_entry(pos, &notes->src->source, node) { 548 list_for_each_entry(pos, &notes->src->source, node) {
548 if (pos->offset != -1) { 549 if (pos->offset != -1 && pos->offset < len) {
549 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8; 550 h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
550 h->sum += h->addr[pos->offset]; 551 h->sum += h->addr[pos->offset];
551 } 552 }