linux-stable/drivers/net/wireless
Gustavo A. R. Silva 0562ebcf05 ray_cs: 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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200319230525.GA14835@embeddedor.com
2020-03-23 19:18:27 +02:00
..
admtek adm80211: Replace zero-length array with flexible-array member 2020-03-23 19:16:11 +02:00
ath Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git 2020-03-16 07:29:55 +02:00
atmel atmel: at76c50x: Replace zero-length array with flexible-array member 2020-03-23 19:17:11 +02:00
broadcom brcmfmac: Replace zero-length array with flexible-array member 2020-03-23 19:12:12 +02:00
cisco proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
intel iwlwifi: move AX200 devices to the new table 2020-03-17 21:10:47 +02:00
intersil p54: Replace zero-length array with flexible-array member 2020-03-23 19:01:13 +02:00
marvell wireless: marvell: Replace zero-length array with flexible-array member 2020-03-23 19:11:09 +02:00
mediatek mt76: mt7615: introduce mt7663e support 2020-03-17 17:48:00 +01:00
quantenna qtnfmac: add interface combination check for repeater mode 2020-03-12 15:38:59 +02:00
ralink
realtek wireless: realtek: Replace zero-length array with flexible-array member 2020-03-23 18:51:56 +02:00
rsi rsi: fix null pointer dereference during rsi_shutdown() 2020-02-12 18:19:14 +02:00
st cw1200: Replace zero-length array with flexible-array member 2020-03-23 19:14:44 +02:00
ti wireless: ti: Replace zero-length array with flexible-array member 2020-03-23 18:55:04 +02:00
zydas zd1211rw: Replace zero-length array with flexible-array member 2020-03-23 19:13:28 +02:00
Kconfig
mac80211_hwsim.c mac80211_hwsim: enable Beacon protection 2020-02-24 10:40:00 +01:00
mac80211_hwsim.h
Makefile
ray_cs.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
ray_cs.h
rayctl.h ray_cs: Replace zero-length array with flexible-array member 2020-03-23 19:18:27 +02:00
rndis_wlan.c
virt_wifi.c
wl3501.h
wl3501_cs.c