Skip to content

Commit

Permalink
perf: Fix off by one in perf_swevent_init()
Browse files Browse the repository at this point in the history
The perf_swevent_enabled[] array has PERF_COUNT_SW_MAX elements.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <20101024195041.GT5985@bicker>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
error27 authored and Ingo Molnar committed Dec 16, 2010
1 parent 5167695 commit ce67783
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -4719,7 +4719,7 @@ static int perf_swevent_init(struct perf_event *event)
break;
}

if (event_id > PERF_COUNT_SW_MAX)
if (event_id >= PERF_COUNT_SW_MAX)
return -ENOENT;

if (!event->parent) {
Expand Down

0 comments on commit ce67783

Please sign in to comment.