linux/arch/mips
Gustavo A. R. Silva c4ad6ea957 MIPS: Replace zero-length array with flexible-array
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2020-05-08 12:01:02 +02:00
..
alchemy MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
ar7 MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
ath25 MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
ath79 MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
bcm47xx MIPS: BCM47XX: Add support for Netgear R6200 V1 2019-07-25 22:10:05 -07:00
bcm63xx MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
bmips MIPS: BMIPS: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-02-19 10:36:02 -08:00
boot MIPS: Truncate link address into 32bit for 32bit kernel 2020-05-07 10:31:01 +02:00
cavium-octeon MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
cobalt MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
configs mips: Drop CONFIG_MTD_M25P80 in various defconfig files 2020-05-02 12:09:52 +02:00
crypto crypto: {arm,arm64,mips}/poly1305 - remove redundant non-reduction from emit 2020-01-16 15:18:12 +08:00
dec MIPS: asm: Rename some macros to avoid build errors 2020-05-07 13:20:05 +02:00
emma MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
fw MIPS: CFE: Remove dead code in cfe_getfwinfo() 2020-05-07 10:29:42 +02:00
generic MIPS: generic: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-02-19 10:36:07 -08:00
include MIPS: Loongson: Add DMA support for LS7A 2020-05-08 12:00:07 +02:00
jazz MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
jz4740 MIPS: ingenic: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-05-07 11:59:55 +02:00
kernel MIPS: Replace zero-length array with flexible-array 2020-05-08 12:01:02 +02:00
kvm MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
lantiq remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
lasat MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
lib MIPS: do not compile generic functions for CONFIG_CAVIUM_OCTEON_SOC 2020-03-25 16:07:13 +01:00
loongson2ef mips: loongsoon2ef: remove private clk api 2020-04-16 17:34:23 +02:00
loongson32 MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
loongson64 MIPS: Loongson: Add DMA support for LS7A 2020-05-08 12:00:07 +02:00
math-emu MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
mm MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
mti-malta MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
net MIPS: BPF: Use sizeof_field() instead of FIELD_SIZEOF() 2020-01-10 11:33:35 -08:00
netlogic MIPS: Netlogic: remove unneeded semicolon in fmn_message_handler() 2020-04-19 16:05:19 +02:00
oprofile MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
paravirt
pci MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
pic32 MIPS: pic32mzda: Drop pointless static qualifier 2020-02-28 12:44:39 +01:00
pistachio MIPS: Pistachio: Replace <linux/clk-provider.h> by <linux/of_clk.h> 2020-02-19 10:36:21 -08:00
pmcs-msp71xx MIPS: Rename the "Fill" cache ops to avoid build failure 2020-04-26 15:40:50 +02:00
pnx833x A batch of MIPS fixes: 2019-06-08 13:09:31 -07:00
power mips: check for dsp presence only once before save/restore 2019-10-07 10:58:53 -07:00
ralink MIPS: ralink: mt7621: Fix soc_device introduction 2020-03-28 17:26:36 +01:00
rb532 remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
sgi-ip22 MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
sgi-ip27 mfd: ioc3: Add driver for SGI IOC3 chip 2020-01-09 15:30:59 -08:00
sgi-ip30 MIPS: SGI-IP30: Check for valid pointer before using it 2020-01-22 10:15:45 -08:00
sgi-ip32 MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
sibyte treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
sni MIPS: pass non-NULL dev_id on shared request_irq() 2020-03-16 16:04:49 +01:00
tools MIPS: tools: Move "returns" after "loongson3-llsc-check" 2020-05-04 10:18:41 +02:00
txx9 MIPS: TXx9: Fix Kconfig warnings 2020-04-14 12:52:28 +02:00
vdso .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
vr41xx MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
Kbuild treewide: Add SPDX license identifier - Kbuild 2019-05-30 11:32:33 -07:00
Kbuild.platforms MIPS: add support for SGI Octane (IP30) 2019-11-01 14:58:56 -07:00
Kconfig MIPS: cleanup fixup_bigphys_addr handling 2020-04-19 16:09:44 +02:00
Kconfig.debug MIPS: cmdline: Remove redundant Kconfig defaults 2019-10-09 15:53:16 -07:00
Makefile MIPS: Truncate link address into 32bit for 32bit kernel 2020-05-07 10:31:01 +02:00
Makefile.postlink MIPS: fix indentation of the 'RELOCS' message 2020-01-20 15:37:30 -08:00