diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2013-08-07 16:18:08 -0700 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-09-10 01:57:23 +0100 |
commit | 1cf253ee0a4a3102a1dc89a3001abb31a8b60c00 (patch) | |
tree | 4da87ce92c8348bff9695af5bf50dfba297ac7d8 /arch | |
parent | 5fff965ef7b5b2a3715b1a4005e6515716e49305 (diff) |
perf/arm: Fix armpmu_map_hw_event()
commit b88a2595b6d8aedbd275c07dfa784657b4f757eb upstream.
Fix constraint check in armpmu_map_hw_event().
Reported-and-tested-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/kernel/perf_event.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 0ea8083bc52..4a2db48c148 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -116,7 +116,12 @@ armpmu_map_cache_event(const unsigned (*cache_map) static int armpmu_map_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; } |