linux_dsm_epyc7002/arch/x86
Kees Cook 9038ec99ce x86/xen: Distribute switch variables for initialization
Variables declared in a switch statement before any case statements
cannot be automatically initialized with compiler instrumentation (as
they are not part of any execution flow). With GCC's proposed automatic
stack variable initialization feature, this triggers a warning (and they
don't get initialized). Clang's automatic stack variable initialization
(via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
doesn't initialize such variables[1]. Note that these warnings (or silent
skipping) happen before the dead-store elimination optimization phase,
so even when the automatic initializations are later elided in favor of
direct initializations, the warnings remain.

To avoid these problems, move such variables into the "case" where
they're used or lift them up into the main function body.

arch/x86/xen/enlighten_pv.c: In function ‘xen_write_msr_safe’:
arch/x86/xen/enlighten_pv.c:904:12: warning: statement will never be executed [-Wswitch-unreachable]
  904 |   unsigned which;
      |            ^~~~~

[1] https://bugs.llvm.org/show_bug.cgi?id=44916

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20200220062318.69299-1-keescook@chromium.org
Reviewed-by: Juergen Gross <jgross@suse.com>
[boris: made @which an 'unsigned int']
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
2020-02-20 10:16:40 -06:00
..
boot x86/boot: kbuild: allow readelf executable to be specified 2019-12-14 15:53:04 +09:00
configs
crypto
entry
events perf/x86/intel: Fix PT PMI handling 2019-12-17 13:32:46 +01:00
hyperv
ia32
include
kernel Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-12-21 06:04:12 -08:00
kvm PPC: 2019-12-22 10:26:59 -08:00
lib
math-emu
mm mm/memory_hotplug: shrink zones when offlining memory 2020-01-04 13:55:08 -08:00
net
oprofile
pci
platform
power
purgatory
ras
realmode
tools
um um: Implement copy_thread_tls 2020-01-07 13:31:29 +01:00
video
xen x86/xen: Distribute switch variables for initialization 2020-02-20 10:16:40 -06:00
.gitignore
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile
Makefile_32.cpu
Makefile.um