From: Konstantin Stepanyuk Date: Wed, 26 May 2010 22:10:11 +0000 (+0400) Subject: perf hist: fix objdump output parsing X-Git-Tag: v2.6.35-rc2~47^2~1^2~2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=75d9ef1707cf3db264a549142a1f54a5380d63dc;p=~shefty%2Frdma-dev.git 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 Cc: Frédéric Weisbecker Cc: Ingo Molnar Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Tom Zanussi LKML-Reference: Signed-off-by: Konstantin Stepanyuk Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cbf7eae2ce0..07f89b66b31 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, * Parse hexa addresses followed by ':' */ line_ip = strtoull(tmp, &tmp2, 16); - if (*tmp2 != ':') + if (*tmp2 != ':' || tmp == tmp2) line_ip = -1; }