linux/arch/sparc/kernel
Rick Edgecombe b80fa3cbb7 treewide: use initializer for struct vm_unmapped_area_info
Future changes will need to add a new member to struct
vm_unmapped_area_info.  This would cause trouble for any call site that
doesn't initialize the struct.  Currently every caller sets each member
manually, so if new ones are added they will be uninitialized and the core
code parsing the struct will see garbage in the new member.

It could be possible to initialize the new member manually to 0 at each
call site.  This and a couple other options were discussed.  Having some
struct vm_unmapped_area_info instances not zero initialized will put those
sites at risk of feeding garbage into vm_unmapped_area(), if the
convention is to zero initialize the struct and any new field addition
missed a call site that initializes each field manually.  So it is useful
to do things similar across the kernel.

The consensus (see links) was that in general the best way to accomplish
taking into account both code cleanliness and minimizing the chance of
introducing bugs, was to do C99 static initialization.  As in: struct
vm_unmapped_area_info info = {};

With this method of initialization, the whole struct will be zero
initialized, and any statements setting fields to zero will be unneeded. 
The change should not leave cleanup at the call sides.

While iterating though the possible solutions a few archs kindly acked
other variations that still zero initialized the struct.  These sites have
been modified in previous changes using the pattern acked by the
respective arch.

So to be reduce the chance of bugs via uninitialized fields, perform a
tree wide change using the consensus for the best general way to do this
change.  Use C99 static initializing to zero the struct and remove and
statements that simply set members to zero.

Link: https://lkml.kernel.org/r/20240326021656.202649-11-rick.p.edgecombe@intel.com
Link: https://lore.kernel.org/lkml/202402280912.33AEE7A9CF@keescook/#t
Link: https://lore.kernel.org/lkml/j7bfvig3gew3qruouxrh7z7ehjjafrgkbcmg6tcghhfh3rhmzi@wzlcoecgy5rs/
Link: https://lore.kernel.org/lkml/ec3e377a-c0a0-4dd3-9cb9-96517e54d17e@csgroup.eu/
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Deepak Gupta <debug@rivosinc.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: H. Peter Anvin (Intel) <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-04-25 20:56:27 -07:00
..
syscalls lsm/stable-6.8 PR 20240105 2024-01-09 12:57:46 -08:00
.gitignore
adi_64.c
apc.c
asm-offsets.c arch: fix asm-offsets.c building with -Wmissing-prototypes 2023-11-23 11:32:31 +01:00
audit.c
auxio_32.c
auxio_64.c
btext.c sparc: Use shared font data 2024-02-16 16:49:58 +01:00
central.c
cherrs.S
chmc.c Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>" 2024-03-06 13:07:39 -08:00
compat_audit.c
cpu.c
cpumap.c sparc: Annotate struct cpuinfo_tree with __counted_by 2023-10-06 13:25:17 -07:00
cpumap.h
devices.c
ds.c Normalise "name (ad@dr)" MODULE_AUTHORs to "name <ad@dr>" 2024-03-06 13:07:39 -08:00
dtlb_miss.S
dtlb_prot.S
ebus.c
entry.h
entry.S
etrap_32.S
etrap_64.S
fpu_traps.S
ftrace.c
getsetcc.S
head_32.S
head_64.S
helpers.S
hvapi.c
hvcalls.S
hvtramp.S
idprom.c
iommu-common.c
iommu.c
iommu_common.h
ioport.c
irq.h
irq_32.c sparc32: Fix build with trapbase 2024-03-08 21:20:23 +01:00
irq_64.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
itlb_miss.S
ivec.S
jump_label.c
kernel.h sparc32: Fix build with trapbase 2024-03-08 21:20:23 +01:00
kgdb_32.c sparc32: Fix build with trapbase 2024-03-08 21:20:23 +01:00
kgdb_64.c
kprobes.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
kstack.h
ktlb.S
ldc.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
led.c
leon_kernel.c
leon_pci.c
leon_pci_grpci1.c sparc32: Fix section mismatch in leon_pci_grpci 2024-03-08 21:21:00 +01:00
leon_pci_grpci2.c sparc32: Fix section mismatch in leon_pci_grpci 2024-03-08 21:21:00 +01:00
leon_pmc.c
leon_smp.c sparc32: Fix build with trapbase 2024-03-08 21:20:23 +01:00
Makefile arch: turn off -Werror for architectures with known warnings 2023-12-10 17:21:33 -08:00
mdesc.c
misctrap.S
module.c
nmi.c sparc64: NMI watchdog: fix return value of __setup handler 2024-02-16 16:50:25 +01:00
of_device_32.c
of_device_64.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
of_device_common.c
of_device_common.h
pci.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
pci_common.c
pci_fire.c
pci_impl.h sparc: Fix typos 2024-02-16 16:50:25 +01:00
pci_msi.c
pci_psycho.c
pci_sabre.c sparc: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
pci_schizo.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
pci_sun4v.c mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER 2024-01-08 15:27:15 -08:00
pci_sun4v.h
pci_sun4v_asm.S
pcic.c
pcr.c
perf_event.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
pmc.c
power.c
process.c
process_32.c
process_64.c
prom.h
prom_32.c
prom_64.c
prom_common.c
prom_irqtrans.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
psycho_common.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
psycho_common.h
ptrace_32.c
ptrace_64.c
reboot.c
rtrap_32.S
rtrap_64.S
sbus.c
setup_32.c sparc32: Fix build with trapbase 2024-03-08 21:20:23 +01:00
setup_64.c vgacon, arch/*: remove unused screen_info definitions 2023-10-17 10:17:02 +02:00
signal32.c
signal_32.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
signal_64.c sparc: Fix typos 2024-02-16 16:50:25 +01:00
sigutil.h
sigutil_32.c
sigutil_64.c
smp_32.c
smp_64.c smp: Consolidate smp_prepare_boot_cpu() 2024-03-04 12:01:54 +01:00
sparc_ksyms.c
spiterrs.S
sstate.c
stacktrace.c
starfire.c
sun4d_irq.c
sun4d_smp.c
sun4m_irq.c
sun4m_smp.c
sun4v_ivec.S
sun4v_mcd.S
sun4v_tlb_miss.S
sys32.S
sys_sparc32.c
sys_sparc_32.c treewide: use initializer for struct vm_unmapped_area_info 2024-04-25 20:56:27 -07:00
sys_sparc_64.c treewide: use initializer for struct vm_unmapped_area_info 2024-04-25 20:56:27 -07:00
syscalls.S
sysfs.c
systbls.h
systbls_32.S
systbls_64.S
termios.c
time_32.c
time_64.c
trampoline_32.S
trampoline_64.S
traps_32.c arch: include linux/cpu.h for trap_init() prototype 2023-11-23 11:32:31 +01:00
traps_64.c asm-generic cleanups for 6.8 2024-01-10 18:13:44 -08:00
tsb.S
ttable_32.S
ttable_64.S
una_asm_32.S
una_asm_64.S
unaligned_32.c
unaligned_64.c
uprobes.c
urtt_fill.S
utrap.S
vdso.c
vio.c sparc: vio: make vio_bus_type const 2024-02-16 16:50:25 +01:00
viohs.c
visemul.c
vmlinux.lds.S
windows.c
winfixup.S
wof.S
wuf.S