linux/include/video
Gustavo A. R. Silva 451787d3e2 video: 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: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200221160005.GA13552@embeddedor
2020-03-02 16:32:17 +01:00
..
atmel_lcdc.h
aty128.h
broadsheetfb.h
cirrus.h
cvisionppc.h
da8xx-fb.h fbdev: da8xx: remove panel_power_ctrl() callback from platform data 2019-08-26 17:53:58 +05:30
display_timing.h
edid.h
gbe.h
hecubafb.h
ili9320.h
imx-ipu-image-convert.h
imx-ipu-v3.h
kyro.h
mach64.h
maxinefb.h
mbxfb.h
metronomefb.h
mipi_display.h drm/dsi: rename MIPI_DCS_SET_PARTIAL_AREA to MIPI_DCS_SET_PARTIAL_ROWS 2019-11-07 14:59:56 +02:00
mmp_disp.h video: Replace zero-length array with flexible-array member 2020-03-02 16:32:17 +01:00
neomagic.h
newport.h
of_display_timing.h
of_videomode.h
omap-panel-data.h
omapfb_dss.h
omapvrfb.h
permedia2.h
platform_lcd.h
pm3fb.h
pmag-ba-fb.h
pmagb-b-fb.h
pxa168fb.h
radeon.h
s1d13xxxfb.h
sa1100fb.h
samsung_fimd.h video: exynos: Rename Exynos to lowercase 2020-01-15 17:31:51 +01:00
sh_mobile_lcdc.h
sisfb.h
sstfb.h
tdfx.h
tgafb.h
trident.h
udlfb.h
uvesafb.h
vga.h
videomode.h
w100fb.h