perf trace: Fix read_string()
Commit-ID: 6f4596d9312ba5fbf5f3231ef484823c4e684d2e Gitweb: http://git.kernel.org/tip/6f4596d9312ba5fbf5f3231ef484823c4e684d2e Author: Ingo Molnar <[email protected]> AuthorDate: Thu, 3 Sep 2009 16:22:45 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 3 Sep 2009 16:22:45 +0200
perf trace: Fix read_string()
We did not account for the enclosing \0. Depending on what malloc() gave us this resulted in corrupted version string printouts.
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- tools/perf/util/trace-event-read.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
tools/perf/util/trace-event-read.c +4 -1
@@ -113,8 +113,11 @@ static char *read_string(void) } } +/* trailing \0: */ + i++; +/* move the file descriptor to the end of the string */ - r =lseek (input_fd, -(r - (i+1 )),SEEK_CUR ); + r =lseek (input_fd, -(r - i),SEEK_CUR );if (r <0 )die ("lseek" );