linux/drivers/gpu/drm/vmwgfx
Gustavo A. R. Silva 6b65675542 drm/vmwgfx: 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: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2020-03-16 10:42:01 +01:00
..
device_include drm/vmwgfx: Add surface dirty-tracking callbacks 2019-11-06 15:45:32 +01:00
Kconfig drm/vmwgfx: Implement an infrastructure for write-coherent resources 2019-11-06 13:04:54 +01:00
Makefile drm/vmwgfx: Implement an infrastructure for write-coherent resources 2019-11-06 13:04:54 +01:00
ttm_lock.c
ttm_lock.h
ttm_object.c
ttm_object.h
vmwgfx_binding.c
vmwgfx_binding.h
vmwgfx_blit.c
vmwgfx_bo.c drm/vmwgfx: Use an RBtree instead of linked list for MOB resources 2019-11-06 13:30:27 +01:00
vmwgfx_cmdbuf_res.c drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add 2020-01-15 11:46:59 +01:00
vmwgfx_cmdbuf.c drm/vmwgfx: Fix the refuse_dma mode when using guest-backed objects 2020-03-12 12:00:07 +01:00
vmwgfx_context.c
vmwgfx_cotable.c
vmwgfx_drv.c drm/vmwgfx: Refuse DMA operation when SEV encryption is active 2020-03-12 12:00:07 +01:00
vmwgfx_drv.h drm/vmwgfx: Remove a few unused functions 2020-03-12 15:31:12 +01:00
vmwgfx_execbuf.c drm/vmwgfx: Replace deprecated PTR_RET 2020-01-15 11:46:58 +01:00
vmwgfx_fb.c drm: constify fb ops across all drivers 2019-12-05 10:57:42 +02:00
vmwgfx_fence.c
vmwgfx_fence.h
vmwgfx_fifo.c drm/vmwgfx: Drop preempt_disable() in vmw_fifo_ping_host() 2020-03-12 15:29:38 +01:00
vmwgfx_gmr.c
vmwgfx_gmrid_manager.c
vmwgfx_ioctl.c
vmwgfx_irq.c
vmwgfx_kms.c drm/vmwgfx: Remove a few unused functions 2020-03-12 15:31:12 +01:00
vmwgfx_kms.h
vmwgfx_ldu.c drm/vmwgfx: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
vmwgfx_marker.c
vmwgfx_mob.c
vmwgfx_msg.c drm/vmwgfx: add ioctl for messaging from/to guest userspace to/from host 2020-01-15 11:54:16 +01:00
vmwgfx_msg.h
vmwgfx_overlay.c drm/vmwgfx: Remove a few unused functions 2020-03-12 15:31:12 +01:00
vmwgfx_page_dirty.c drm/vmwgfx: Replace zero-length array with flexible-array member 2020-03-16 10:42:01 +01:00
vmwgfx_prime.c drm/vmwgfx: Delete mmaping functions 2019-11-25 22:36:14 +01:00
vmwgfx_reg.h
vmwgfx_resource_priv.h drm/vmwgfx: Implement an infrastructure for read-coherent resources 2019-11-06 13:30:27 +01:00
vmwgfx_resource.c drm/vmwgfx: Implement an infrastructure for read-coherent resources 2019-11-06 13:30:27 +01:00
vmwgfx_scrn.c drm/vmwgfx: Convert to CRTC VBLANK callbacks 2020-02-13 13:10:10 +01:00
vmwgfx_shader.c
vmwgfx_simple_resource.c
vmwgfx_so.c
vmwgfx_so.h
vmwgfx_stdu.c drm/vmwgfx: Fix the refuse_dma mode when using guest-backed objects 2020-03-12 12:00:07 +01:00
vmwgfx_surface.c drm/vmwgfx: Replace zero-length array with flexible-array member 2020-03-16 10:42:01 +01:00
vmwgfx_ttm_buffer.c drm/ttm: nuke invalidate_caches callback 2020-01-16 16:35:07 +01:00
vmwgfx_ttm_glue.c drm/vmwgfx: Use VM_PFNMAP instead of VM_MIXEDMAP when possible 2020-01-15 14:34:49 +01:00
vmwgfx_va.c
vmwgfx_validation.c drm/vmwgfx: Implement an infrastructure for read-coherent resources 2019-11-06 13:30:27 +01:00
vmwgfx_validation.h drm/vmwgfx: Implement an infrastructure for write-coherent resources 2019-11-06 13:04:54 +01:00