Skip to content

Commit

Permalink
perf/arm: Fix armpmu_map_hw_event()
Browse files Browse the repository at this point in the history
Fix constraint check in armpmu_map_hw_event().

Reported-and-tested-by: Vince Weaver <[email protected]>
Cc: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
bebarino authored and torvalds committed Aug 13, 2013
1 parent e0acd0a commit b88a259
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)
static int
armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
{
int mapping = (*event_map)[config];
int mapping;

if (config >= PERF_COUNT_HW_MAX)
return -ENOENT;

mapping = (*event_map)[config];
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
}

Expand Down

0 comments on commit b88a259

Please sign in to comment.