linux_dsm_epyc7002/drivers/net/wireless
Gustavo A. R. Silva 14dd3a71cc ath11k: 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 <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200504201224.GA32282@embeddedor
2020-05-06 09:23:08 +03:00
..
admtek adm80211: Replace zero-length array with flexible-array member 2020-03-23 19:16:11 +02:00
ath ath11k: Replace zero-length array with flexible-array 2020-05-06 09:23:08 +03:00
atmel atmel: at76c50x: Replace zero-length array with flexible-array member 2020-03-23 19:17:11 +02:00
broadcom brcmfmac: add USB autosuspend feature support 2020-03-26 11:44:18 +02:00
cisco
intel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-03-31 17:29:33 -07:00
intersil Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-03-31 17:29:33 -07:00
marvell wireless: marvell: Replace zero-length array with flexible-array member 2020-03-23 19:11:09 +02:00
mediatek wireless-drivers-next patches for v5.7 2020-03-24 16:15:58 -07:00
quantenna qtnfmac: add interface combination check for repeater mode 2020-03-12 15:38:59 +02:00
ralink
realtek wireless-drivers-next patches for v5.7 2020-03-27 15:40:24 -07: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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-03-25 18:58:11 -07: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: add frame transmission support over virtio 2020-03-20 14:42:19 +01:00
mac80211_hwsim.h mac80211_hwsim: add frame transmission support over virtio 2020-03-20 14:42:19 +01:00
Makefile
ray_cs.c
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 virt_wifi: implement ndo_get_iflink 2020-03-20 14:42:20 +01:00
wl3501_cs.c
wl3501.h wl3501_cs: Replace zero-length array with flexible-array member 2020-03-23 19:21:21 +02:00