linux/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>
History 2020-02-28 14:51:30 +01:00
..
acpi Merge branches 'acpi-utils', 'acpi-platform', 'acpi-video' and 'acpi-doc' 2019-11-26 10:30:49 +01:00
asm-generic asm-generic/nds32: don't redefine cacheflush primitives 2019-12-30 11:18:43 +01:00
clocksource x86/hyperv: Initialize clockevents earlier in CPU onlining 2019-11-15 10:33:49 +01:00
crypto crypto: ablkcipher - remove deprecated and unused ablkcipher support 2019-11-17 09:02:49 +08:00
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 powerpc updates for 5.5 2019-11-30 14:35:43 -08:00
kunit kunit: fix failure to build without printk 2019-09-30 17:35:01 -06:00
kvm Merge remote-tracking branch 'kvmarm/misc-5.5' into kvmarm/next 2019-11-08 11:27:29 +00:00
linux qed: FW 8.42.2.0 debug features 2020-01-27 14:35:32 +01:00
math-emu nds32: Mark expected switch fall-throughs 2019-08-29 11:06:56 -05:00
media drm main pull for 5.5-rc1 2019-11-27 17:45:48 -08:00
misc auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay 2019-08-08 19:59:17 +02:00
net 6lowpan: Replace zero-length array with flexible-array member 2020-02-28 14:51:30 +01:00
pcmcia It's been a relatively busy cycle for docs: 2019-07-09 12:34:26 -07:00
ras RAS: Use consistent types for UUIDs 2019-01-25 16:40:40 +01:00
rdma IB/core: Add interface to advise_mr for kernel users 2020-01-16 16:14:42 +02:00
scsi scsi: target: iscsi: Wait for all commands to finish before freeing a session 2019-11-19 21:37:35 -05:00
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 scsi: target: Remove tpg_list and se_portal_group.se_tpg_node 2019-10-03 22:00:09 -04:00
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 vdso: Remove superfluous #ifdef __KERNEL__ in vdso/datapage.h 2019-06-26 07:28:09 +02:00
video fbdev: da8xx: remove panel_power_ctrl() callback from platform data 2019-08-26 17:53:58 +05:30
xen xen/interface: re-define FRONT/BACK_RING_ATTACH() 2019-12-20 13:44:42 +01:00