[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-6f4596d9312ba5fbf5f3231ef484823c4e684d2e@git.kernel.org>
Date: Thu, 3 Sep 2009 14:28:15 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl,
efault@....de, fweisbec@...il.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perfcounters/core] perf trace: Fix read_string()
Commit-ID: 6f4596d9312ba5fbf5f3231ef484823c4e684d2e
Gitweb: http://git.kernel.org/tip/6f4596d9312ba5fbf5f3231ef484823c4e684d2e
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Thu, 3 Sep 2009 16:22:45 +0200
Committer: Ingo Molnar <mingo@...e.hu>
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 <a.p.zijlstra@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/util/trace-event-read.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index b12e490..a1217a1 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -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");
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists