From: Konstantin Stepanyuk Date: Wed, 26 May 2010 22:10:11 +0000 (+0400) Subject: perf hist: fix objdump output parsing X-Git-Tag: 2.1b_release~6562^2~233^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75d9ef1707cf3db264a549142a1f54a5380d63dc;p=platform%2Fkernel%2Fkernel-mfld-blackbay.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 cbf7eae..07f89b6 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; }