alistair23-linux/net/wireless
Gustavo A. R. Silva 396fba0a59 cfg80211: 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>
Link: https://lore.kernel.org/r/20200507183909.GA12993@embeddedor
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-05-27 10:02:03 +02:00
..
certs
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
ap.c
chan.c cfg80211: reject channels/chandefs with KHz offset >= 1000 2020-04-24 12:38:20 +02:00
core.c cfg80211: reject channels/chandefs with KHz offset >= 1000 2020-04-24 12:38:20 +02:00
core.h cfg80211: Replace zero-length array with flexible-array 2020-05-27 10:02:03 +02:00
debugfs.c
debugfs.h
ethtool.c cfg80211: check wiphy driver existence for drvinfo report 2020-02-07 12:53:26 +01:00
ibss.c cfg80211: ibss: use 11a mandatory rates for 6GHz band operation 2019-08-21 10:54:57 +02:00
Kconfig
lib80211.c
lib80211_crypt_ccmp.c
lib80211_crypt_tkip.c
lib80211_crypt_wep.c
Makefile
mesh.c
mlme.c cfg80211: add KHz variants of frame RX API 2020-05-27 10:02:02 +02:00
nl80211.c nl80211: support scan frequencies in KHz 2020-05-27 10:02:03 +02:00
nl80211.h nl80211: link recursive netlink nested policy 2020-04-30 17:51:41 -07:00
ocb.c
of.c
pmsr.c nl80211: link recursive netlink nested policy 2020-04-30 17:51:41 -07:00
radiotap.c docs: networking: convert radiotap-headers.txt to ReST 2020-04-30 12:56:37 -07:00
rdev-ops.h cfg80211: change internal management frame registration API 2020-04-24 12:33:40 +02:00
reg.c cfg80211: express channels with a KHz component 2020-04-24 12:33:43 +02:00
reg.h net: Fix various misspellings of "connect" 2019-10-28 13:41:59 -07:00
scan.c cfg80211: express channels with a KHz component 2020-04-24 12:33:43 +02:00
sme.c cfg80211: Unprotected Beacon frame RX indication 2020-04-24 12:33:40 +02:00
sysfs.c
sysfs.h
trace.c
trace.h cfg80211: add KHz variants of frame RX API 2020-05-27 10:02:02 +02:00
util.c cfg80211: express channels with a KHz component 2020-04-24 12:33:43 +02:00
wext-compat.c cfg80211: initialize on-stack chandefs 2019-10-01 17:56:18 +02:00
wext-compat.h
wext-core.c wireless: wext: avoid gcc -O3 warning 2020-01-15 09:52:20 +01:00
wext-priv.c
wext-proc.c
wext-sme.c cfg80211: wext: avoid copying malformed SSIDs 2019-10-04 14:04:08 +02:00
wext-spy.c