2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-26 23:55:40 +08:00
linux-next/drivers/staging
Gustavo A. R. Silva 5979afa2c4 staging: Replace zero-length array with flexible-array member
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]

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 <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200220132908.GA30501@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-23 19:18:54 +01:00
..
android drm pull for 5.6-rc1 2020-01-30 08:04:01 -08:00
axis-fifo staging: axis-fifo: replace spinlock with mutex 2020-01-22 09:58:01 +01:00
board staging: board: use appropriate macro to initialize struct 2019-09-30 21:57:57 +02:00
clocking-wizard staging: clocking-wizard: use devm_platform_ioremap_resource() to simplify code 2019-10-10 11:00:59 +02:00
comedi staging: comedi: ni_pcimio: add routes for NI PCIe-6251 and PCIe-6259 2020-02-10 10:25:06 -08:00
emxx_udc staging: emxx_udc: Fix invalid reference error 2019-10-30 10:38:46 +01:00
exfat staging: exfat: remove exfat_fat_sync() 2020-02-23 19:17:25 +01:00
fbtft fbtft: Fix the initialization from property algorithm 2019-12-10 15:55:55 +01:00
fieldbus staging: fieldbus: anybuss: use devm_platform_ioremap_resource helper 2019-10-27 08:15:43 +01:00
fsl-dpaa2 staging: fsl-dpaa2: ethsw: ethsw.c: Fix line over 80 characters 2020-02-17 18:14:26 +01:00
fwserial staging: fwserial: Fix Kconfig indentation (seven spaces) 2019-11-22 11:32:54 +01:00
gasket staging: gasket: unify multi-line string 2020-02-12 13:37:06 -08:00
gdm724x staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
goldfish
greybus staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
gs_fpgaboot
hp Merge 5.5-rc2 into staging-next 2019-12-16 09:06:50 +01:00
iio iio: adis: Remove startup_delay 2020-01-12 11:34:13 +00:00
kpc2000 Staging/IIO patches for 5.6-rc1 2020-01-29 10:15:11 -08:00
ks7010 staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
media staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
most staging: most: usb: check for NULL device 2020-01-24 10:08:41 +01:00
mt7621-dma staging: mt7621-dma: align to match open parenthesis 2019-11-07 16:14:10 +01:00
mt7621-dts staging: mt7621-dts: fix register range of memc node in mt7621.dtsi 2020-01-10 13:49:18 +01:00
mt7621-pci MIPS: ralink: enable PCI support only if driver for mt7621 SoC is selected 2019-11-14 13:09:37 +08:00
mt7621-pci-phy
mt7621-pinctrl
netlogic staging: netlogic: Use the correct style for SPDX License Identifier 2020-02-09 16:22:58 -08:00
nvec staging: nvec: check return value 2019-12-19 19:23:29 +01:00
octeon Revert "staging/octeon: Mark Ethernet driver as BROKEN" 2020-02-12 13:50:33 -08:00
octeon-usb staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
olpc_dcon staging: olpc_dcon: fix wrong dependencies in Kconfig file 2019-09-30 21:58:00 +02:00
pi433 staging: pi433: Use the correct style for SPDX License Identifier 2020-02-09 16:23:02 -08:00
qlge staging: qlge: add braces on all arms of if-else 2020-02-23 19:18:33 +01:00
ralink-gdma staging: ralink-gdma: use devm_platform_ioremap_resource() to simplify code 2019-10-24 22:40:38 -04:00
rtl8188eu staging: rtl8188eu: rename variable pnetdev -> netdev 2020-02-10 12:37:21 -08:00
rtl8192e staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
rtl8192u staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
rtl8712 staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
rtl8723bs staging: rtl8723bs: Fix spacing issues 2020-02-14 08:18:23 -08:00
rts5208 Staging/IIO patches for 5.6-rc1 2020-01-29 10:15:11 -08:00
sm750fb remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
speakup staging: speakup: document sysfs attributes 2019-10-04 10:06:05 +02:00
unisys staging: unisys: visorinput: Replace zero-length array with flexible-array member 2020-02-11 14:04:53 -08:00
vc04_services staging: vc04_services: Fix wrong early return in next_service_by_instance() 2020-02-13 11:51:14 -08:00
vme compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
vt6655 Staging: vt6655: device_main: cleanup long line 2020-02-09 16:22:56 -08:00
vt6656 staging: vt6656: Remove fall back functions and headers. 2020-02-09 16:22:57 -08:00
wfx staging: wfx: use more power-efficient sleep for reset 2020-02-11 11:15:29 -08:00
wilc1000 staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
wlan-ng staging: Replace zero-length array with flexible-array member 2020-02-23 19:18:54 +01:00
Kconfig Revert "staging: octeon: delete driver" 2020-02-12 13:50:32 -08:00
Makefile Revert "staging: octeon: delete driver" 2020-02-12 13:50:32 -08:00