mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-27 22:51:31 +00:00
af741b0bad
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
|
||
---|---|---|
.. | ||
at91_cf.c | ||
bcm63xx_pcmcia.c | ||
bcm63xx_pcmcia.h | ||
cardbus.c | ||
cirrus.h | ||
cistpl.c | ||
cs.c | ||
cs_internal.h | ||
db1xxx_ss.c | ||
ds.c | ||
electra_cf.c | ||
i82092.c | ||
i82092aa.h | ||
i82365.c | ||
i82365.h | ||
Kconfig | ||
Makefile | ||
max1600.c | ||
max1600.h | ||
o2micro.h | ||
omap_cf.c | ||
pcmcia_cis.c | ||
pcmcia_resource.c | ||
pd6729.c | ||
pd6729.h | ||
pxa2xx_balloon3.c | ||
pxa2xx_base.c | ||
pxa2xx_base.h | ||
pxa2xx_cm_x2xx.c | ||
pxa2xx_cm_x255.c | ||
pxa2xx_cm_x270.c | ||
pxa2xx_colibri.c | ||
pxa2xx_e740.c | ||
pxa2xx_hx4700.c | ||
pxa2xx_mainstone.c | ||
pxa2xx_palmld.c | ||
pxa2xx_palmtc.c | ||
pxa2xx_palmtx.c | ||
pxa2xx_sharpsl.c | ||
pxa2xx_stargate2.c | ||
pxa2xx_trizeps4.c | ||
pxa2xx_viper.c | ||
pxa2xx_vpac270.c | ||
ricoh.h | ||
rsrc_iodyn.c | ||
rsrc_mgr.c | ||
rsrc_nonstatic.c | ||
sa11xx_base.c | ||
sa11xx_base.h | ||
sa1100_generic.c | ||
sa1100_generic.h | ||
sa1100_h3600.c | ||
sa1100_simpad.c | ||
sa1111_badge4.c | ||
sa1111_generic.c | ||
sa1111_generic.h | ||
sa1111_jornada720.c | ||
sa1111_lubbock.c | ||
sa1111_neponset.c | ||
soc_common.c | ||
soc_common.h | ||
socket_sysfs.c | ||
tcic.c | ||
tcic.h | ||
ti113x.h | ||
topic.h | ||
vg468.h | ||
vrc4171_card.c | ||
vrc4173_cardu.c | ||
vrc4173_cardu.h | ||
xxs1500_ss.c | ||
yenta_socket.c | ||
yenta_socket.h |