linux-stable/drivers/pcmcia
Gustavo A. R. Silva af741b0bad pcmcia: soc_common.h: 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: Dominik Brodowski <linux@dominikbrodowski.net>
2020-03-28 07:52:13 +01:00
..
at91_cf.c
bcm63xx_pcmcia.c
bcm63xx_pcmcia.h
cardbus.c
cirrus.h
cistpl.c
cs.c
cs_internal.h pcmcia: cs_internal.h: Replace zero-length array with flexible-array member 2020-03-28 07:52:09 +01:00
db1xxx_ss.c
ds.c
electra_cf.c
i82092.c PCMCIA/i82092: remove #if 0 block 2019-12-16 11:49:54 +01:00
i82092aa.h PCMCIA/i82092: delete enter/leave macro 2019-12-16 11:49:54 +01:00
i82365.c
i82365.h
Kconfig
Makefile
max1600.c
max1600.h
o2micro.h
omap_cf.c pcmcia: omap: remove useless cast for driver.name 2020-03-14 14:32:02 +01:00
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 pcmcia: Use scnprintf() for avoiding potential buffer overflow 2020-03-14 14:32:04 +01:00
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 pcmcia: soc_common.h: Replace zero-length array with flexible-array member 2020-03-28 07:52:13 +01:00
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 pcmcia: Use scnprintf() for avoiding potential buffer overflow 2020-03-14 14:32:04 +01:00
yenta_socket.h