aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2011-02-09 15:56:28 +0000
committerArnaldo Carvalho de Melo <[email protected]>2011-02-16 16:47:55 +0000
commit289c082044643e55f65c6a16bb3621cf3f35a454 (patch)
tree5d4f1bcd70435e16bc0cd57b824d50c25290d972 /tools/perf/util/annotate.c
parentperf ui: Serialize screen updates (diff)
downloadkernel-289c082044643e55f65c6a16bb3621cf3f35a454.tar.gz
kernel-289c082044643e55f65c6a16bb3621cf3f35a454.zip
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 <[email protected]> Cc: Ingo Molnar <[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> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/annotate.c')
-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)
struct annotation *notes = symbol__annotation(sym);
struct sym_hist *h = annotation__histogram(notes, evidx);
struct objdump_line *pos;
+ int len = sym->end - sym->start;
h->sum = 0;
list_for_each_entry(pos, &notes->src->source, node) {
- if (pos->offset != -1) {
+ if (pos->offset != -1 && pos->offset < len) {
h->addr[pos->offset] = h->addr[pos->offset] * 7 / 8;
h->sum += h->addr[pos->offset];
}