linux/drivers/net/ethernet/netronome/nfp
Gustavo A. R. Silva 3f6e963305 netronome: 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-24 15:26:17 -08:00
..
abm Revert "nfp: abm: fix memory leak in nfp_abm_u32_knode_replace" 2019-12-13 18:13:22 -08:00
bpf netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
crypto nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
flower netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
nfpcore netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
nic treewide: remove dummy Makefiles for single targets 2019-08-21 21:05:21 +09:00
ccm_mbox.c nfp: ccm: increase message limits 2019-07-08 20:21:09 -07:00
ccm.c nfp: add support for sending control messages via mailbox 2019-06-06 14:13:39 -07:00
ccm.h nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
devlink_param.c nfp: devlink: set unknown fw_load_policy 2019-09-11 15:10:05 +01:00
Makefile nfp: add devlink param infrastructure 2019-09-10 17:29:27 +01:00
nfp_abi.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_app_nic.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_app.c nfp: add offloads on representors 2018-11-30 13:30:44 -08:00
nfp_app.h nfp: allow fallback packets from non-reprs 2019-04-15 15:45:36 -07:00
nfp_asm.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_asm.h nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_devlink.c net: devlink: Add extack to shared buffer operations 2019-04-22 22:09:32 -07:00
nfp_hwmon.c nfp: replace long license headers with SPDX 2018-10-11 12:16:21 -07:00
nfp_main.c kdoc: fix nfp_fw_load documentation 2019-09-10 17:29:27 +01:00
nfp_main.h netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
nfp_net_common.c nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
nfp_net_ctrl.c nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
nfp_net_ctrl.h nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
nfp_net_debugdump.c netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
nfp_net_debugfs.c nfp: no need to check return value of debugfs_create functions 2019-08-10 15:25:48 -07:00
nfp_net_ethtool.c nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
nfp_net_main.c nfp: add devlink param infrastructure 2019-09-10 17:29:27 +01:00
nfp_net_repr.c net: core: add generic lockdep keys 2019-10-24 14:53:48 -07:00
nfp_net_repr.h netronome: Replace zero-length array with flexible-array member 2020-02-24 15:26:17 -08:00
nfp_net_sriov.c nfp: add SR-IOV trusted VF support 2019-04-19 21:00:31 -07:00
nfp_net_sriov.h nfp: add SR-IOV trusted VF support 2019-04-19 21:00:31 -07:00
nfp_net.h nfp: tls: implement the stream sync RX resync 2019-12-19 17:46:51 -08:00
nfp_netvf_main.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
nfp_port.c nfp: reintroduce ndo_get_port_parent_id for representor ports 2019-05-08 16:32:36 -07:00
nfp_port.h nfp: move devlink port type set after netdev registration 2019-03-24 14:55:31 -04:00
nfp_shared_buf.c net: devlink: report cell size of shared buffers 2019-02-03 11:25:34 -08:00