linux-stable/include
Gustavo A. R. Silva 8788a1ee07 6lowpan: 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: Marcel Holtmann <marcel@holtmann.org>
2020-02-28 14:51:30 +01:00
..
acpi
asm-generic asm-generic/nds32: don't redefine cacheflush primitives 2019-12-30 11:18:43 +01:00
clocksource
crypto
drm drm/dp_mst: Have DP_Tx send one msg at a time 2020-01-15 17:01:21 -05:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2019-12-09 15:21:20 -08:00
keys
kunit
kvm
linux qed: FW 8.42.2.0 debug features 2020-01-27 14:35:32 +01:00
math-emu
media
misc
net 6lowpan: Replace zero-length array with flexible-array member 2020-02-28 14:51:30 +01:00
pcmcia
ras
rdma IB/core: Add interface to advise_mr for kernel users 2020-01-16 16:14:42 +02:00
scsi
soc Merge ra.kernel.org:/pub/scm/linux/kernel/git/netdev/net 2020-01-19 22:10:04 +01:00
sound ASoC: Fixes for v5.5 2019-12-17 14:18:32 +01:00
target
trace Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-01-26 10:40:21 +01:00
uapi ethtool: add WOL_NTF notification 2020-01-27 11:31:36 +01:00
vdso
video
xen xen/interface: re-define FRONT/BACK_RING_ATTACH() 2019-12-20 13:44:42 +01:00