linux/drivers/net/wireless/realtek/rtlwifi
Gustavo A. R. Silva a1b7714b72 wireless: realtek: 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/20200225002746.GA26789@embeddedor
2020-03-23 18:51:56 +02:00
..
btcoexist rtlwifi: btcoex: fix spelling mistake "initilized" -> "initialized" 2020-01-26 17:47:54 +02:00
rtl8188ee rtlwifi: rtl8188ee: remove redundant assignment to variable cond 2020-01-26 17:45:15 +02:00
rtl8192c rtlwifi: rtl8192ce: rtl8192c_com: Remove usage of private bit manipulation macros 2019-12-18 20:22:28 +02:00
rtl8192ce rtlwifi: rtl8192ce: Make functions static & rm sw.h 2020-01-26 17:39:37 +02:00
rtl8192cu rtlwifi: rtl8192cu: Remove sw.h header 2020-01-26 17:39:38 +02:00
rtl8192de rtlwifi: rtl8192de: use generic rtl_signal_scale_mapping 2019-12-18 21:06:53 +02:00
rtl8192ee rtlwifi: rtl8192ee: remove unused variables 2020-01-26 17:46:39 +02:00
rtl8192se rtlwifi: rtl8192se: Remove sw.h header 2020-01-26 17:39:41 +02:00
rtl8723ae rtlwifi: rtl8723ae: remove unused variables 2020-01-26 17:47:10 +02:00
rtl8723be rtlwifi: rtl8723be: Make functions static & rm sw.h 2020-01-26 17:39:44 +02:00
rtl8723com rtlwifi: set proper udelay within rf_serial_read 2019-11-20 09:41:30 +02:00
rtl8821ae rtlwifi: rtl8821ae: remove unused variables 2020-01-26 17:45:43 +02:00
base.c mac80211: simplify TX aggregation start 2019-10-04 13:58:13 +02:00
base.h rtlwifi: Remove dependence on special bit manipulation macros for common driver 2019-12-18 20:22:29 +02:00
cam.c rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
cam.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
core.c rtlwifi: Fix all blank line irregularities in main code files 2019-02-28 10:30:02 +02:00
core.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
debug.c rtlwifi: Fix file release memory leak 2019-09-06 17:11:36 +03:00
debug.h rtlwifi: Remove CamelCase variables from base code 2019-02-19 17:02:51 +02:00
efuse.c rtlwifi: Remove set but not used variables 'dataempty','hoffset' 2019-10-02 07:32:50 +03:00
efuse.h rtlwifi: Remove CamelCase variables from base code 2019-02-19 17:02:51 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile
pci.c rtlwifi: rtl_pci: Fix -Wcast-function-type 2019-12-18 20:54:44 +02:00
pci.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
ps.c rtlwifi: Remove dependence on special bit manipulation macros for common driver 2019-12-18 20:22:29 +02:00
ps.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
pwrseqcmd.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
rc.c mac80211: call rate_control_send_low() internally 2019-06-14 14:17:37 +02:00
rc.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
regd.c rtlwifi: Remove unnecessary NULL check in rtl_regd_init 2019-10-24 08:47:07 +03:00
regd.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
stats.c rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
stats.h rtlwifi: Replace old-style license information 2019-02-19 16:59:43 +02:00
usb.c rtlwifi: prevent memory leak in rtl_usb_probe 2019-10-01 12:20:29 +03:00
usb.h rtlwifi: Fix blank line errors in main header files 2019-02-28 10:30:01 +02:00
wifi.h wireless: realtek: Replace zero-length array with flexible-array member 2020-03-23 18:51:56 +02:00