linux/drivers/net/wireless/ath
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
..
ar5523 ar5523: fix spelling mistake "to" -> "too" 2020-01-26 16:36:15 +02:00
ath5k ath5k: remove conversion to bool in ath5k_ani_calibration() 2020-04-28 12:11:27 +03:00
ath6kl ath6kl: Replace zero-length array with flexible-array 2020-05-06 09:21:30 +03:00
ath9k ath9k_htc: Silence undersized packet warnings 2020-05-06 09:22:18 +03:00
ath10k ath10k: Add support for targets without trustzone 2020-05-05 10:36:03 +03:00
ath11k ath11k: Replace zero-length array with flexible-array 2020-05-06 09:23:08 +03:00
carl9170 carl9170: remove P2P_GO support 2020-05-06 09:14:20 +03:00
wcn36xx wcn36xx: fix spelling mistake "to" -> "too" 2020-01-26 16:40:19 +02:00
wil6210 wil6210: reject unsupported coalescing params 2020-03-06 22:45:55 -08:00
ath.h ath: Remove unnecessary ath_bcast_mac and use eth_broadcast_addr 2018-03-29 12:10:26 +03:00
debug.c
dfs_pattern_detector.c ath: DFS JP domain W56 fixed pulse type 3 RADAR detection 2019-04-29 17:58:51 +03:00
dfs_pattern_detector.h ath: add support to get the detected radar specifications 2018-05-25 13:15:21 +03:00
dfs_pri_detector.c
dfs_pri_detector.h ath: add support to get the detected radar specifications 2018-05-25 13:15:21 +03:00
hw.c
Kconfig Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git 2019-12-10 11:34:30 +02:00
key.c
main.c
Makefile ath11k: driver for Qualcomm IEEE 802.11ax devices 2019-11-25 14:16:34 +02:00
reg.h
regd_common.h ath: regd: add extra US coutry codes 2019-02-07 17:02:19 +02:00
regd.c ath: add support for special 0x0 regulatory domain 2019-12-02 12:08:01 +02:00
regd.h ath: drop duplicated define 2019-04-29 17:55:53 +03:00
spectral_common.h
trace.c
trace.h