mirror-linux/arch/x86/kernel/cpu
Muralidhara M K ba8ffb1251 x86/MCE/AMD: Use an u64 for bank_map
[ Upstream commit 4c1cdec319 ]

Thee maximum number of MCA banks is 64 (MAX_NR_BANKS), see

  a0bc32b3ca ("x86/mce: Increase maximum number of banks to 64").

However, the bank_map which contains a bitfield of which banks to
initialize is of type unsigned int and that overflows when those bit
numbers are >= 32, leading to UBSAN complaining correctly:

  UBSAN: shift-out-of-bounds in arch/x86/kernel/cpu/mce/amd.c:1365:38
  shift exponent 32 is too large for 32-bit type 'int'

Change the bank_map to a u64 and use the proper BIT_ULL() macro when
modifying bits in there.

  [ bp: Rewrite commit message. ]

Fixes: a0bc32b3ca ("x86/mce: Increase maximum number of banks to 64")
Signed-off-by: Muralidhara M K <muralimk@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230127151601.1068324-1-muralimk@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:03:10 +09:00
..
mce x86/MCE/AMD: Use an u64 for bank_map 2023-05-11 23:03:10 +09:00
microcode x86/microcode/AMD: Fix mixed steppings support 2023-03-10 09:34:14 +01:00
mtrr
resctrl x86/resctrl: Clear staged_config[] before and after it is used 2023-03-22 13:34:05 +01:00
sgx x86/sgx: Reduce delay and interference of enclave release 2022-12-31 13:31:55 +01:00
.gitignore
Makefile x86: kmsan: disable instrumentation of unsupported code 2022-10-03 14:03:24 -07:00
acrn.c x86/acrn: Set up timekeeping 2022-08-04 11:11:59 +02:00
amd.c x86/CPU/AMD: Disable XSAVES on AMD family 0x17 2023-03-17 08:50:15 +01:00
aperfmperf.c x86/aperfmperf: Erase stale arch_freq_scale values when disabling frequency invariance readings 2023-02-09 11:28:12 +01:00
bugs.c x86/speculation: Allow enabling STIBP with legacy IBRS 2023-03-10 09:34:14 +01:00
cacheinfo.c x86/cacheinfo: move shared cache map definitions 2022-07-17 17:31:40 -07:00
centaur.c
common.c x86/microcode: Check CPU capabilities after late microcode update correctly 2023-03-10 09:32:56 +01:00
cpu.h x86/cpu/amd: Add Spectral Chicken 2022-06-27 10:34:00 +02:00
cpuid-deps.c x86/fpu: Optimize out sigframe xfeatures when in init state 2021-11-03 22:42:35 +01:00
cyrix.c x86/cyrix: include header linux/isa-dma.h 2022-07-26 14:03:12 -05:00
feat_ctl.c x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype 2022-09-26 17:06:27 +02:00
hygon.c x86/cpu: Restore AMD's DE_CFG MSR after resume 2022-11-15 10:15:58 -08:00
hypervisor.c
intel.c x86/split_lock: Add sysctl to control the misery mode 2022-12-31 13:31:55 +01:00
intel_epb.c x86: intel_epb: Allow model specific normal EPB value 2022-01-04 16:37:23 +01:00
intel_pconfig.c
match.c
mkcapflags.sh
mshyperv.c x86/hyperv: Block root partition functionality in a Confidential VM 2023-05-11 23:02:57 +09:00
perfctr-watchdog.c
powerflags.c
proc.c x86/aperfmperf: Integrate the fallback code from show_cpuinfo() 2022-04-27 20:22:20 +02:00
rdrand.c x86/rdrand: Remove "nordrand" flag in favor of "random.trust_cpu" 2022-07-18 15:04:04 +02:00
scattered.c x86/cpufeatures: Add LbrExtV2 feature bit 2022-08-27 00:05:42 +02:00
topology.c x86/topology: Fix duplicated core ID within a package 2022-10-17 11:58:52 -07:00
transmeta.c
tsx.c x86/tsx: Add a feature bit for TSX control MSR support 2022-11-21 14:08:20 +01:00
umc.c
umwait.c
vmware.c x86/vmware: Use BIT() macro for shifting 2022-06-22 11:23:14 +02:00
vortex.c x86/CPU: Add support for Vortex CPUs 2021-10-21 15:49:07 +02:00
zhaoxin.c