Loading
arm: perf: Fix ARCH=arm build with GCC
mainline inclusion from mainline-v6.8-rc1 commit bb339db4d363c84e0a8d70827df591397ccd7312 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9Q7QP CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=bb339db4d363c84e0a8d70827df591397ccd7312 -------------------------------- LLVM ignores everything inside the if statement and doesn't generate errors, but GCC doesn't ignore it, resulting in the following error: drivers/perf/arm_pmuv3.c: In function ‘armv8pmu_write_evtype’: include/linux/bits.h:34:29: error: left shift count >= width of type [-Werror=shift-count-overflow] 34 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ Fix it by using GENMASK_ULL which doesn't overflow on arm32 (even though the value is never used there). Fixes: 3115ee021bfb ("arm64: perf: Include threshold control fields in PMEVTYPER mask") Reported-by:Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Closes: https://lore.kernel.org/linux-arm-kernel/20231215120817.h2f3akgv72zhrtqo@pengutronix.de/ Signed-off-by:
James Clark <james.clark@arm.com> Acked-by:
Mark Rutland <mark.rutland@arm.com> Reviewed-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20231215175648.3397170-2-james.clark@arm.com Signed-off-by:
Will Deacon <will@kernel.org> Signed-off-by:
Junhao He <hejunhao3@huawei.com>