linux_dsm_epyc7002/drivers/gpu/drm/vboxvideo
Gustavo A. R. Silva afdd597940 drm/vboxvideo/vboxvideo.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>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200305105558.GA19124@embeddedor
2020-03-07 12:55:05 +01:00
..
hgsmi_base.c
hgsmi_ch_setup.h
hgsmi_channels.h
hgsmi_defs.h
Kconfig drm/vram: fix Kconfig 2019-09-10 08:53:08 +02:00
Makefile drm/vboxvideo: Switch to generic fbdev emulation 2019-10-16 09:58:30 +02:00
modesetting.c
vbox_drv.c drm/vram: drop DRM_VRAM_MM_FILE_OPERATIONS 2019-10-17 13:59:16 +02:00
vbox_drv.h drm/vboxvideo: Replace struct vram_framebuffer with generic implemenation 2019-10-16 09:58:59 +02:00
vbox_hgsmi.c
vbox_irq.c
vbox_main.c drm/vboxvideo: Replace struct vram_framebuffer with generic implemenation 2019-10-16 09:58:59 +02:00
vbox_mode.c drm/vboxvideo: Implement struct drm_mode_config_funcs.mode_valid 2020-02-06 10:34:06 +01:00
vbox_ttm.c drm/vram: Have VRAM MM call GEM VRAM functions directly 2019-09-12 19:54:42 +02:00
vboxvideo_guest.h
vboxvideo_vbe.h
vboxvideo.h drm/vboxvideo/vboxvideo.h: Replace zero-length array with flexible-array member 2020-03-07 12:55:05 +01:00
vbva_base.c