linux-stable/arch
Anders Roxell c8d95668c4 arm64: KVM: regmap: Fix unexpected switch fall-through
commit 3d584a3c85 upstream.

When fall-through warnings was enabled by default, commit d93512ef0f0e
("Makefile: Globally enable fall-through warning"), the following
warnings was starting to show up:

In file included from ../arch/arm64/include/asm/kvm_emulate.h:19,
                 from ../arch/arm64/kvm/regmap.c:13:
../arch/arm64/kvm/regmap.c: In function ‘vcpu_write_spsr32’:
../arch/arm64/include/asm/kvm_hyp.h:31:3: warning: this statement may fall
 through [-Wimplicit-fallthrough=]
   asm volatile(ALTERNATIVE(__msr_s(r##nvh, "%x0"), \
   ^~~
../arch/arm64/include/asm/kvm_hyp.h:46:31: note: in expansion of macro ‘write_sysreg_elx’
 #define write_sysreg_el1(v,r) write_sysreg_elx(v, r, _EL1, _EL12)
                               ^~~~~~~~~~~~~~~~
../arch/arm64/kvm/regmap.c:180:3: note: in expansion of macro ‘write_sysreg_el1’
   write_sysreg_el1(v, SYS_SPSR);
   ^~~~~~~~~~~~~~~~
../arch/arm64/kvm/regmap.c:181:2: note: here
  case KVM_SPSR_ABT:
  ^~~~
In file included from ../arch/arm64/include/asm/cputype.h:132,
                 from ../arch/arm64/include/asm/cache.h:8,
                 from ../include/linux/cache.h:6,
                 from ../include/linux/printk.h:9,
                 from ../include/linux/kernel.h:15,
                 from ../include/asm-generic/bug.h:18,
                 from ../arch/arm64/include/asm/bug.h:26,
                 from ../include/linux/bug.h:5,
                 from ../include/linux/mmdebug.h:5,
                 from ../include/linux/mm.h:9,
                 from ../arch/arm64/kvm/regmap.c:11:
../arch/arm64/include/asm/sysreg.h:837:2: warning: this statement may fall
 through [-Wimplicit-fallthrough=]
  asm volatile("msr " __stringify(r) ", %x0"  \
  ^~~
../arch/arm64/kvm/regmap.c:182:3: note: in expansion of macro ‘write_sysreg’
   write_sysreg(v, spsr_abt);
   ^~~~~~~~~~~~
../arch/arm64/kvm/regmap.c:183:2: note: here
  case KVM_SPSR_UND:
  ^~~~

Rework to add a 'break;' in the swich-case since it didn't have that,
leading to an interresting set of bugs.

Cc: stable@vger.kernel.org # v4.17+
Fixes: a892819560 ("KVM: arm64: Prepare to handle deferred save/restore of 32-bit registers")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
[maz: reworked commit message, fixed stable range]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-25 10:47:58 +02:00
..
alpha alpha: Fix Eiger NR_IRQS to 128 2019-02-20 10:25:47 +01:00
arc ARC: enable uboot support unconditionally 2019-08-06 19:06:57 +02:00
arm ARM: dts: bcm: bcm47094: add missing #cells for mdio-bus-mux 2019-08-16 10:12:49 +02:00
arm64 arm64: KVM: regmap: Fix unexpected switch fall-through 2019-08-25 10:47:58 +02:00
c6x kbuild: rename LDFLAGS to KBUILD_LDFLAGS 2018-08-24 08:22:08 +09:00
h8300 h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- 2019-04-05 22:32:55 +02:00
hexagon hexagon: modify ffs() and fls() to return int 2018-09-10 19:42:15 -05:00
ia64 ia64: fix build errors by exporting paddr_to_nid() 2019-06-22 08:15:19 +02:00
m68k m68k: Add -ffreestanding to CFLAGS 2019-03-23 20:10:00 +01:00
microblaze mm: make the __PAGETABLE_PxD_FOLDED defines non-empty 2018-12-29 13:37:57 +01:00
mips MIPS: lantiq: Fix bitfield masking 2019-08-06 19:06:48 +02:00
nds32 nds32: Fix gcc 8.0 compiler option incompatible. 2019-02-12 19:46:57 +01:00
nios2 nios2: kconfig: remove duplicate DEBUG_STACK_USAGE symbol defintions 2018-08-27 09:47:20 +08:00
openrisc OpenRISC updates for 4.19 2018-08-23 14:09:37 -07:00
parisc parisc: Fix build of compressed kernel even with debug enabled 2019-08-06 19:06:55 +02:00
powerpc KVM: Fix leak vCPU's VMCS value into other pCPU 2019-08-16 10:12:53 +02:00
riscv riscv: Make __fstate_clean() work correctly. 2019-08-25 10:47:51 +02:00
s390 s390/dma: provide proper ARCH_ZONE_DMA_BITS value 2019-08-16 10:12:50 +02:00
sh sh: kernel: hw_breakpoint: Fix missing break in switch statement 2019-08-25 10:47:42 +02:00
sparc sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD 2019-06-25 11:35:57 +08:00
um um: Silence lockdep complaint about mmap_sem 2019-07-31 07:27:04 +02:00
unicore32 mm: convert return type of handle_mm_fault() caller to vm_fault_t 2018-08-17 16:20:28 -07:00
x86 KVM: Fix leak vCPU's VMCS value into other pCPU 2019-08-16 10:12:53 +02:00
xtensa xtensa: add missing isync to the cpu_reset TLB code 2019-08-25 10:47:47 +02:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00