perf_counter tools: Fix index boundary check
authorRoel Kluin <[email protected]>
Mon, 13 Jul 2009 00:25:47 +0000 (02:25 +0200)
committerIngo Molnar <[email protected]>
Mon, 13 Jul 2009 08:58:28 +0000 (10:58 +0200)
Keep index within event_type_descriptors[]

Signed-off-by: Roel Kluin <[email protected]>
Cc: Andrew Morton <[email protected]>
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: <4A5A7F0B.4070106@gmail.com>
Signed-off-by: Ingo Molnar <[email protected]>
tools/perf/util/parse-events.c

index 518a33affe1a2fd5b58a0ae9b4644f623896a23b..d18c98edd00d839c5d3e361493e033222a180e30 100644 (file)
@@ -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)