[tip:perfcounters/urgent] perf_counter tools: Fix index boundary check

From: tip-bot for Roel Kluin
Date: Mon Jul 13 2009 - 05:02:20 EST


Commit-ID: 23cdb5d5171d591ec911aada682e09d53c14a810
Gitweb: http://git.kernel.org/tip/23cdb5d5171d591ec911aada682e09d53c14a810
Author: Roel Kluin <roel.kluin@xxxxxxxxx>
AuthorDate: Mon, 13 Jul 2009 02:25:47 +0200
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Mon, 13 Jul 2009 10:58:28 +0200

perf_counter tools: Fix index boundary check

Keep index within event_type_descriptors[]

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
LKML-Reference: <4A5A7F0B.4070106@xxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
tools/perf/util/parse-events.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 518a33a..d18c98e 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -436,7 +436,7 @@ void print_events(void)

for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
type = syms->type + 1;
- if (type > ARRAY_SIZE(event_type_descriptors))
+ if (type >= ARRAY_SIZE(event_type_descriptors))
type = 0;

if (type != prev_type)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/