summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2013-08-07 16:18:08 -0700
committerHarry Hong <hhong@nvidia.com>2014-01-16 23:11:34 -0800
commit08167a2dd32469127521ed6a20c35b94df6533a3 (patch)
tree659b734976c8ca9b4354ae1b3d2e0134416ec368 /arch
parent01a11aeb6343c2a93509d1e40cbadb62aa7cc025 (diff)
perf/arm: Fix armpmu_map_hw_event()
Change-Id: Ib0409a5f7a4aeec93e535757dcd9d2c04330f495 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> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Change-Id: I97050b1481003481b81cbdfeb898ae7478561d2a Reviewed-on: http://git-master/r/356830 Reviewed-by: Harry Hong <hhong@nvidia.com> Tested-by: Harry Hong <hhong@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/perf_event.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index a99ed7a09d9b..c82fa0f955cd 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;
}