linux/drivers/gpu/drm/mga
Kees Cook 10579b75e0 drm/mga/mga_ioc32: Use struct_group() for memcpy() region
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Use struct_group() in struct drm32_mga_init around members chipset, sgram,
maccess, fb_cpp, front_offset, front_pitch, back_offset, back_pitch,
depth_cpp, depth_offset, depth_pitch, texture_offset, and texture_size,
so they can be referenced together. This will allow memcpy() and sizeof()
to more easily reason about sizes, improve readability, and avoid future
warnings about writing beyond the end of chipset.

"pahole" shows no size nor member offset changes to struct drm32_mga_init.
"objdump -d" shows no meaningful object code changes (i.e. only source
line number induced differences and optimizations).

Note that since this is a UAPI header, __struct_group() is used
directly.

Cc: David Airlie <airlied@linux.ie>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Link: https://lore.kernel.org/lkml/YQKa76A6XuFqgM03@phenom.ffwll.local
2021-09-25 08:20:48 -07:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mga_dma.c drm: IRQ midlayer is now legacy 2021-08-10 20:14:01 +02:00
mga_drv.c drm/mga: drop use of drmP.h 2019-06-30 09:48:05 +02:00
mga_drv.h drm: IRQ midlayer is now legacy 2021-08-10 20:14:01 +02:00
mga_ioc32.c drm/mga/mga_ioc32: Use struct_group() for memcpy() region 2021-09-25 08:20:48 -07:00
mga_irq.c drm/mga: drop use of drmP.h 2019-06-30 09:48:05 +02:00
mga_state.c drm/mga: Remove references to struct drm_device.pdev 2021-05-03 19:48:24 +02:00
mga_warp.c drm/mga: drop use of drmP.h 2019-06-30 09:48:05 +02:00