perf/x86: Fix potential out-of-bounds access
authorPeter Zijlstra <peterz@infradead.org>
Fri, 6 Dec 2019 11:50:16 +0000 (12:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Jan 2020 11:21:36 +0000 (12:21 +0100)
commit1997c9c22275dd0c3bd40305a187fa94f6d4b300
tree5db91f7768a0e63b57218dcd8ce8a0c16dc456d6
parent142c711f66a387dd14eed31dbf91bf64d2d90c2a
perf/x86: Fix potential out-of-bounds access

[ Upstream commit 1e69a0efc0bd0e02b8327e7186fbb4a81878ea0b ]

UBSAN reported out-of-bound accesses for x86_pmu.event_map(), it's
arguments should be < x86_pmu.max_events. Make sure all users observe
this constraint.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/events/core.c