From: Roel Kluin Date: Mon, 13 Jul 2009 00:25:47 +0000 (+0200) Subject: perf_counter tools: Fix index boundary check X-Git-Tag: v2.6.31-rc4~3^2~18 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=23cdb5d5171d591ec911aada682e09d53c14a810;p=~shefty%2Frdma-dev.git perf_counter tools: Fix index boundary check Keep index within event_type_descriptors[] Signed-off-by: Roel Kluin Cc: Andrew Morton Cc: Peter Zijlstra Cc: Mike Galbraith Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker LKML-Reference: <4A5A7F0B.4070106@gmail.com> Signed-off-by: Ingo Molnar --- diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 518a33affe1..d18c98edd00 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)