OpenCloudOS-Kernel/drivers/net/wan
Gustavo A. R. Silva 37e1244a79 WAN: 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: David S. Miller <davem@davemloft.net>
2020-02-27 12:06:55 -08:00
..
lmc netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
.gitignore
Kconfig wan: ixp4xx_hss: prepare compile testing 2020-01-12 12:59:52 -08:00
Makefile net/wan: dscc4: remove broken dscc4 driver 2019-09-16 09:14:41 +02:00
c101.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
cosa.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
cosa.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
dlci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
farsync.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
farsync.h WAN: Replace zero-length array with flexible-array member 2020-02-27 12:06:55 -08:00
fsl_ucc_hdlc.c ARM: SoC-related driver updates 2020-02-08 14:04:19 -08:00
fsl_ucc_hdlc.h net/wan/fsl_ucc_hdlc: avoid use of IS_ERR_VALUE() 2019-12-09 13:57:45 -06:00
hd64570.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hd64570.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hd64572.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hd64572.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hdlc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_cisco.c drivers: net: cisco_hdlc: use __func__ in debug message 2020-01-07 13:33:35 -08:00
hdlc_fr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_ppp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_raw.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_raw_eth.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
hdlc_x25.c hdlx_x25: Fix backwards compat test. 2020-01-21 12:02:25 +01:00
hostess_sv11.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
ixp4xx_hss.c wan: ixp4xx_hss: prepare compile testing 2020-01-12 12:59:52 -08:00
lapbether.c net: wan: lapbether.c: Use built-in RCU list checking 2020-01-16 14:30:52 +01:00
n2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
pc300too.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
pci200syn.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
sbni.c net: wan: sbni: replace dev_kfree_skb_irq by dev_consume_skb_irq for drop profiles 2019-02-25 14:36:15 -08:00
sbni.h
sdla.c net: wan: sdla: Fix cast from pointer to integer of different size 2020-01-06 13:30:03 -08:00
sealevel.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
slic_ds26522.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
slic_ds26522.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
wanxl.c WAN: Replace zero-length array with flexible-array member 2020-02-27 12:06:55 -08:00
wanxl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
wanxlfw.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
wanxlfw.inc_shipped
x25_asy.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
x25_asy.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
z85230.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
z85230.h Remove every trace of SERIAL_MAGIC 2019-11-13 19:01:14 +08:00