diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2013-08-07 16:18:08 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-20 08:26:27 -0700 |
commit | 2e42d79b7e06a080d55da0b05c823c0ba2abaa0c (patch) | |
tree | 6b370045d9c0d1fa3622e1bc3faf4f7e21c77cad /arch/arm | |
parent | 13cbe0fb40b67a9551455b2d7fe6eac3f5e9e18d (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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm')
-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 a99ed7a09d9..c82fa0f955c 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -109,7 +109,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; } |