OpenCloudOS-Kernel/drivers/net/ethernet/aquantia/atlantic
Gustavo A. R. Silva 0fcf466643 net: atlantic: 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-03-02 11:16:28 -08:00
..
hw_atl net: atlantic: Replace zero-length array with flexible-array member 2020-03-02 11:16:28 -08:00
Makefile net: atlantic: change email domains to Marvell 2019-11-07 19:54:43 -08:00
aq_cfg.h net/aquantia: Delete module version 2020-02-24 11:24:47 -08:00
aq_common.h net/aquantia: Delete module version 2020-02-24 11:24:47 -08:00
aq_drvinfo.c net: aquantia: make all files GPL-2.0-only 2019-06-27 10:58:32 -07:00
aq_drvinfo.h net: aquantia: make all files GPL-2.0-only 2019-06-27 10:58:32 -07:00
aq_ethtool.c net/aquantia: Delete module version 2020-02-24 11:24:47 -08:00
aq_ethtool.h net: atlantic: loopback tests via private flags 2019-11-07 19:54:43 -08:00
aq_filters.c net: atlantic: fix out of range usage of active_vlans array 2020-02-16 19:03:40 -08:00
aq_filters.h net: aquantia: make all files GPL-2.0-only 2019-06-27 10:58:32 -07:00
aq_hw.h net: atlantic: ptp gpio adjustments 2020-02-16 19:03:39 -08:00
aq_hw_utils.c net: atlantic: code style cleanup 2019-11-07 19:54:43 -08:00
aq_hw_utils.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
aq_main.c net/aquantia: Delete module version 2020-02-24 11:24:47 -08:00
aq_main.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
aq_nic.c net: atlantic: fix potential error handling 2020-02-16 19:03:39 -08:00
aq_nic.h net: atlantic: update flow control logic 2019-11-07 19:54:43 -08:00
aq_pci_func.c net: atlantic: possible fault in transition to hibernation 2020-02-16 19:03:40 -08:00
aq_pci_func.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
aq_phy.c net: aquantia: add support for Phy access 2019-10-24 09:51:23 -07:00
aq_phy.h net: aquantia: add support for Phy access 2019-10-24 09:51:23 -07:00
aq_ptp.c net: atlantic: stylistic renames 2019-11-07 19:54:43 -08:00
aq_ptp.h net: aquantia: remove unused including <linux/version.h> 2019-10-29 16:18:10 -07:00
aq_ring.c net: atlantic: fix use after free kasan warn 2020-02-16 19:03:39 -08:00
aq_ring.h net: atlantic: checksum compat issue 2020-02-16 19:03:39 -08:00
aq_rss.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
aq_utils.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
aq_vec.c net: atlantic: Signedness bug in aq_vec_isr_legacy() 2019-11-13 14:29:28 -08:00
aq_vec.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00