diff options
author | Konstantin Stepanyuk <kostyas@cqg.com> | 2010-05-26 18:10:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-06-01 04:44:36 -0400 |
commit | 75d9ef1707cf3db264a549142a1f54a5380d63dc (patch) | |
tree | b23265c9b0ad7fb042e3f472ca5fed7b0a0205d3 /tools | |
parent | 546cf44a1b507c1cbb5cf42bbe6169780567f36f (diff) |
perf hist: fix objdump output parsing
hist_entry__annotate() runs objdump with -S option so the output may contain
lines of any format. If a line starts with a colon strtoull() returns 0 and
calculated offset will be negative. This causes perf annotate segfaults.
Make sure that strtoull() has parsed at least one digit.
Cc: David S. Miller <davem@davemloft.net>
Cc: Frédéric 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: Konstantin Stepanyuk <konstantin.stepanyuk@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/hist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cbf7eae2ce09..07f89b66b318 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -965,7 +965,7 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file, | |||
965 | * Parse hexa addresses followed by ':' | 965 | * Parse hexa addresses followed by ':' |
966 | */ | 966 | */ |
967 | line_ip = strtoull(tmp, &tmp2, 16); | 967 | line_ip = strtoull(tmp, &tmp2, 16); |
968 | if (*tmp2 != ':') | 968 | if (*tmp2 != ':' || tmp == tmp2) |
969 | line_ip = -1; | 969 | line_ip = -1; |
970 | } | 970 | } |
971 | 971 | ||