Skip to content

Commit b6664df

Browse files
bebarinogregkh
authored andcommitted
perf/arm: Fix armpmu_map_hw_event()
commit b88a259 upstream. Fix constraint check in armpmu_map_hw_event(). Reported-and-tested-by: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 78de90f commit b6664df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm/kernel/perf_event.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)
5353
static int
5454
armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
5555
{
56-
int mapping = (*event_map)[config];
56+
int mapping;
57+
58+
if (config >= PERF_COUNT_HW_MAX)
59+
return -ENOENT;
60+
61+
mapping = (*event_map)[config];
5762
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
5863
}
5964

0 commit comments

Comments
 (0)