linux/arch/mips
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
..
alchemy MIPS: Alchemy: Use kcalloc() instead of kzalloc() 2024-02-20 13:36:34 +01:00
ath25 MIPS: ath25: Constify static irq_domain_ops 2022-02-22 09:39:03 +01:00
ath79 MIPS: ath79: remove obsolete ATH79_DEV_* configs 2023-03-17 10:28:04 +01:00
bcm47xx MIPS: Fix typos 2024-01-08 10:39:12 +01:00
bcm63xx MIPS: BCM63XX: Fix missing prototypes 2024-01-26 10:33:20 +01:00
bmips MIPS: Explicitly include correct DT includes 2023-07-25 10:42:01 +02:00
boot mips: dts: ralink: mt7621: add cell count properties to usb 2024-03-11 13:58:35 +01:00
cavium-octeon Just cleanups and fixes 2024-01-17 11:20:50 -08:00
cobalt MIPS: Cobalt: Fix missing prototypes 2024-01-22 10:32:21 +01:00
configs MIPS: Add support for Mobileye EyeQ5 2024-02-20 13:36:34 +01:00
crypto crypto: mips/crc32 - remove redundant setting of alignmask to 0 2023-10-27 18:04:24 +08:00
dec MIPS: fix typos in comments 2022-05-04 22:22:59 +02:00
fw MIPS: fw arc: Fix missing prototypes 2024-01-22 11:12:01 +01:00
generic MIPS: Share generic kernel code with other architecture 2024-02-20 13:36:25 +01:00
include mm/treewide: remove pXd_huge() 2024-04-25 20:55:47 -07:00
ingenic
jazz change alloc_pages name in dma_map_ops to avoid name conflicts 2024-04-25 20:55:53 -07:00
kernel MIPS: scall: Save thread_info.syscall unconditionally on entry 2024-04-09 16:52:21 +02:00
kvm S390: 2024-03-15 13:03:13 -07:00
lantiq MIPS: lantiq: register smp_ops on non-smp platforms 2024-01-26 10:36:21 +01:00
lib mips: implement xor_unlock_is_negative_byte 2023-10-18 14:34:17 -07:00
loongson2ef MIPS: Fix typos 2024-01-08 10:39:12 +01:00
loongson32 MIPS: loongson32: Remove dma.h and nand.h 2023-10-06 10:10:13 +02:00
loongson64 mm: Introduce vmap_page_range() to map pages in PCI address space 2024-03-11 16:58:10 +01:00
math-emu MIPS: Fix comment typo 2022-09-12 15:33:24 +02:00
mm treewide: use initializer for struct vm_unmapped_area_info 2024-04-25 20:56:27 -07:00
mobileye MIPS: Add support for Mobileye EyeQ5 2024-02-20 13:36:34 +01:00
mti-malta vgacon: clean up global screen_info instances 2023-10-17 10:17:02 +02:00
n64
net MIPS: Fix typos 2024-01-08 10:39:12 +01:00
pci MIPS: TXx9: Use PCI_SET_ERROR_RESPONSE() 2024-02-20 13:36:35 +01:00
pic32 MIPS: Fixup explicit DT include clean-up 2023-07-28 11:41:09 +02:00
power mips: suspend: include linux/suspend.h as needed 2023-12-10 17:21:41 -08:00
ralink MIPS: ralink: Don't use "proxy" headers 2024-03-11 13:57:18 +01:00
rb532 MIPS: rb532: move GPIOD definition into C-files 2022-03-30 20:26:26 +02:00
sgi-ip22 mips: sgi-ip22: make gio_bus_type const 2024-02-20 13:36:34 +01:00
sgi-ip27 MIPS: sgi-ip27: Fix missing prototypes 2024-01-22 11:11:49 +01:00
sgi-ip30 MIPS: sgi-ip30: Fix missing prototypes 2024-01-22 11:12:08 +01:00
sgi-ip32 MIPS: sgi-ip32: Fix missing prototypes 2024-01-22 11:12:19 +01:00
sibyte mips: sibyte: make tb_class constant 2024-03-07 17:19:08 +01:00
sni vgacon: clean up global screen_info instances 2023-10-17 10:17:02 +02:00
tools MIPS: fix typos in comments 2022-05-04 22:22:59 +02:00
txx9 mips: txx9: make txx9_sramc_subsys const 2024-02-20 13:36:34 +01:00
vdso arch: vdso: consolidate gettime prototypes 2023-11-23 11:32:32 +01:00
Kbuild MIPS: Share generic kernel code with other architecture 2024-02-20 13:36:25 +01:00
Kbuild.platforms MIPS: Add support for Mobileye EyeQ5 2024-02-20 13:36:34 +01:00
Kconfig MIPS: move unselectable FIT_IMAGE_FDT_EPM5 out of the "System type" choice 2024-03-27 01:58:34 +09:00
Kconfig.debug
Makefile MIPS: Loongson64: test for -march=loongson3a cflag 2024-02-23 10:13:47 +01:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00