linux-stable/arch
D Scott Phillips b09b539c15 arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro
[ Upstream commit 8ec8490a19 ]

CONFIG_UBSAN_SHIFT with gcc-5 complains that the shifting of
ARM_CPU_IMP_AMPERE (0xC0) into bits [31:24] by MIDR_CPU_MODEL() is
undefined behavior. Well, sort of, it actually spells the error as:

 arch/arm64/kernel/proton-pack.c: In function 'spectre_bhb_loop_affected':
 arch/arm64/include/asm/cputype.h:44:2: error: initializer element is not constant
   (((imp)   << MIDR_IMPLEMENTOR_SHIFT) | \
   ^

This isn't an issue for other Implementor codes, as all the other codes
have zero in the top bit and so are representable as a signed int.

Cast the implementor code to unsigned in MIDR_CPU_MODEL to remove the
undefined behavior.

Fixes: 0e5d5ae837 ("arm64: Add AMPERE1 to the Spectre-BHB affected list")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
Link: https://lore.kernel.org/r/20221102160106.1096948-1-scott@os.amperecomputing.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-26 09:27:30 +01:00
..
alpha provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
arc arc: iounmap() arg is volatile 2022-11-04 00:00:27 +09:00
arm ARM: at91: pm: avoid soft resetting AC DLL 2022-11-26 09:27:26 +01:00
arm64 arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro 2022-11-26 09:27:30 +01:00
csky Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
hexagon provide arch_test_bit_acquire for architectures that define test_bit 2022-08-27 09:49:54 -07:00
ia64 ia64: export memory_add_physaddr_to_nid to fix cxl build error 2022-10-21 12:38:34 +02:00
loongarch LoongArch: Clean up loongson3_smp_ops declaration 2022-09-29 10:15:00 +08:00
m68k m68k: Rework BI_VIRT_RNG_SEED as BI_RNG_SEED 2022-11-16 10:03:48 +01:00
microblaze - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
mips MIPS: jump_label: Fix compat branch range check 2022-11-16 10:04:04 +01:00
nios2 nios2: add force_successful_syscall_return() 2022-08-15 11:25:32 -05:00
openrisc Updates to various subsystems which I help look after. lib, ocfs2, 2022-08-07 10:03:24 -07:00
parisc parisc: Avoid printing the hardware path twice 2022-11-10 18:17:36 +01:00
powerpc powerpc/64e: Fix amdgpu build on Book3E w/o AltiVec 2022-11-26 09:27:19 +01:00
riscv riscv: fix reserved memory setup 2022-11-16 10:04:04 +01:00
s390 KVM: s390: pci: Fix allocation size of aift kzdev elements 2022-11-16 10:03:54 +01:00
sh sh: machvec: Use char[] for section boundaries 2022-10-21 12:37:59 +02:00
sparc sparc: Unbreak the build 2022-10-12 09:39:04 +02:00
um UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2022-10-21 12:37:40 +02:00
x86 KVM: SVM: move MSR_IA32_SPEC_CTRL save/restore to assembly 2022-11-26 09:27:23 +01:00
xtensa Merge 'irq/loongarch', 'pci/ctrl/loongson' and 'pci/header-cleanup-immutable' 2022-08-11 21:06:14 +08:00
.gitignore
Kconfig asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig. 2022-09-05 17:20:55 +02:00