linux/drivers/gpu/drm
Ville Syrjälä d008bc331f drm/bridge: Use drm_mode_copy()
struct drm_display_mode embeds a list head, so overwriting
the full struct with another one will corrupt the list
(if the destination mode is on a list). Use drm_mode_copy()
instead which explicitly preserves the list head of
the destination mode.

Even if we know the destination mode is not on any list
using drm_mode_copy() seems decent as it sets a good
example. Bad examples of not using it might eventually
get copied into code where preserving the list head
actually matters.

Obviously one case not covered here is when the mode
itself is embedded in a larger structure and the whole
structure is copied. But if we are careful when copying
into modes embedded in structures I think we can be a
little more reassured that bogus list heads haven't been
propagated in.

@is_mode_copy@
@@
drm_mode_copy(...)
{
...
}

@depends on !is_mode_copy@
struct drm_display_mode *mode;
expression E, S;
@@
(
- *mode = E
+ drm_mode_copy(mode, &E)
|
- memcpy(mode, E, S)
+ drm_mode_copy(mode, E)
)

@depends on !is_mode_copy@
struct drm_display_mode mode;
expression E;
@@
(
- mode = E
+ drm_mode_copy(&mode, &E)
|
- memcpy(&mode, E, S)
+ drm_mode_copy(&mode, E)
)

@@
struct drm_display_mode *mode;
@@
- &*mode
+ mode

Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220218100403.7028-7-ville.syrjala@linux.intel.com
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-14 17:38:13 +02:00
..
amd drm/sched: Add device pointer to drm_gpu_scheduler 2022-02-23 10:04:14 +01:00
arm drm/komeda: plane: Remove redundant color encoding and range initialisation 2022-03-08 12:03:46 +01:00
armada drm/armada: Add support for the nomodeset kernel parameter 2022-01-27 19:15:48 +01:00
aspeed drm/aspeed: Add AST2600 chip support 2022-03-03 09:08:35 +10:30
ast drm/ast: Move SIL164-based connector code into separate helpers 2022-02-08 13:40:18 +01:00
atmel-hlcdc drm/atmel-hlcdc: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:46 +01:00
bridge drm/bridge: Use drm_mode_copy() 2022-03-14 17:38:13 +02:00
dp drm/dp: Fix OOB read when handling Post Cursor2 register 2022-02-25 10:24:20 +01:00
etnaviv drm/sched: Add device pointer to drm_gpu_scheduler 2022-02-23 10:04:14 +01:00
exynos Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2022-02-07 17:03:24 +01:00
fsl-dcu drm/fsl-dcu: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:46 +01:00
gma500 drm/gma500: Add support for the nomodeset kernel parameter 2022-01-27 19:15:48 +01:00
gud drm/format-helper: Rework format-helper conversion functions 2021-11-11 12:06:57 +01:00
hisilicon drm/hisilicon/kirin: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:46 +01:00
hyperv drm/hyperv: Add support for the nomodeset kernel parameter 2022-01-27 19:15:48 +01:00
i2c
i810
i915 drm: implement a method to free unused pages 2022-02-22 13:03:00 +01:00
imx drm/imx: Add support for the nomodeset kernel parameter 2022-01-27 19:15:49 +01:00
ingenic drm/ingenic: Fix support for JZ4780 HDMI output 2022-02-14 12:27:01 +00:00
kmb drm/kmb: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:46 +01:00
lib drm/selftests: add drm buddy alloc range testcase 2022-02-23 10:44:43 +01:00
lima drm/sched: Add device pointer to drm_gpu_scheduler 2022-02-23 10:04:14 +01:00
mcde drm/mcde: Add support for the nomodeset kernel parameter 2022-01-27 19:15:49 +01:00
mediatek drm/mediatek: implement the DSI HS packets aligned 2022-03-09 14:14:38 +01:00
meson drm: Drop commas after SoC match table sentinels 2022-03-07 11:20:07 +01:00
mga
mgag200 drm/mgag200: Replace module-init boiler-plate code with DRM helpers 2022-01-27 19:14:17 +01:00
msm drm/msm/mdp5: Remove redundant zpos initialisation 2022-02-25 17:56:38 +01:00
mxsfb drm: mxsfb: Use dev_err_probe() helper 2022-02-03 09:50:15 +01:00
nouveau drm/nouveau/instmem: fix uninitialized_var.cocci warning 2022-03-03 17:18:24 -05:00
omapdrm drm/omap: fix NULL but dereferenced coccicheck error 2022-03-08 10:53:52 +02:00
panel drm/panel: simple: Initialize bpc in RK101II01D-CT panel descriptor 2022-02-28 11:43:27 +02:00
panfrost drm/panfrost: cleanup comments 2022-03-02 13:53:24 +00:00
pl111 drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
qxl drm/qxl: Replace module-init boiler-plate code with DRM helpers 2022-01-27 19:15:29 +01:00
r128 Linux 5.15-rc7 2021-10-28 14:59:38 +10:00
radeon drm/radeon: remove resource accounting v2 2022-02-15 17:51:09 +01:00
rcar-du drm/rcar: plane: Remove redundant zpos initialisation 2022-02-25 17:57:01 +01:00
rockchip Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2022-02-07 17:03:24 +01:00
savage
scheduler drm/sched: Add device pointer to drm_gpu_scheduler 2022-02-23 10:04:14 +01:00
selftests drm/selftests: missing error code in igt_buddy_alloc_smoke() 2022-03-07 17:07:54 +01:00
shmobile drm/shmobile: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:47 +01:00
sis
solomon drm: ssd130x: Always apply segment remap setting 2022-03-09 14:55:52 +01:00
sprd drm/sprd: check the platform_get_resource() return value 2022-02-14 21:53:17 +08:00
sti drm/sti: plane: Remove redundant zpos initialisation 2022-02-25 17:57:05 +01:00
stm drm/stm: ltdc: add support for CRC hashing feature 2022-02-25 14:14:28 +01:00
sun4i drm/sun4i: layer: Remove redundant zpos initialisation 2022-02-25 17:57:10 +01:00
tdfx
tegra drm/dp: Fix OOB read when handling Post Cursor2 register 2022-02-25 10:24:20 +01:00
tidss drm/tidss: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:47 +01:00
tilcdc drm/tilcdc: Add support for the nomodeset kernel parameter 2022-01-27 19:15:50 +01:00
tiny drm/tiny: Add MIPI DBI compatible SPI driver 2022-02-28 10:29:33 +01:00
ttm drm/ttm: add common accounting to the resource mgr v3 2022-02-14 14:35:09 +01:00
tve200 drm/tve200: Use drm_module_platform_driver() to register the driver 2022-01-27 19:15:48 +01:00
udl drm/udl: fix control-message timeout 2021-11-05 11:15:14 +01:00
v3d drm/v3d: centralize error handling when init scheduler fails 2022-03-01 22:37:13 -01:00
vboxvideo drm/vboxvideo: Replace module-init boiler-plate code with DRM helpers 2022-01-27 19:15:34 +01:00
vc4 drm/vc4: Use drm_mode_copy() 2022-02-21 09:54:28 +01:00
vgem drm: Return error codes from struct drm_driver.gem_create_object 2021-12-02 11:12:39 +01:00
via
virtio drm/gem-shmem: Set vm_ops in static initializer 2022-02-14 09:42:01 +01:00
vkms drm/vkms: add support for multiple overlay planes 2022-01-09 16:14:35 -01:00
vmwgfx drm/vmwgfx: Stop using surface dma commands on most configurations 2022-03-11 13:29:38 -05:00
xen drm/xen: Add support for the nomodeset kernel parameter 2022-01-27 19:15:50 +01:00
xlnx Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2022-02-07 17:03:24 +01:00
Kconfig drm/selftests: Move i915 buddy selftests into drm 2022-02-23 10:43:25 +01:00
Makefile drm: Add driver for Solomon SSD130x OLED displays 2022-02-16 13:29:04 +01:00
drm_agpsupport.c
drm_aperture.c
drm_atomic.c Merge drm/drm-fixes into drm-misc-fixes 2022-01-26 09:40:24 +01:00
drm_atomic_helper.c drm: fix error found in some cases after the patch d1af5cd86997 2022-01-14 14:31:54 +01:00
drm_atomic_state_helper.c drm/object: Add default color encoding and range value at reset 2022-02-25 17:57:14 +01:00
drm_atomic_uapi.c drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_a*.c 2021-11-26 16:45:22 +01:00
drm_auth.c drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_a*.c 2021-11-26 16:45:22 +01:00
drm_blend.c
drm_bridge.c
drm_bridge_connector.c drm/bridge_connector: enable HPD by default if supported 2022-03-04 19:34:24 +00:00
drm_buddy.c drm/selftests: add drm buddy alloc range testcase 2022-02-23 10:44:43 +01:00
drm_bufs.c
drm_cache.c drm: Stop spamming log with drm_cache message 2022-02-03 11:30:24 -08:00
drm_client.c
drm_client_modeset.c drm: Convert open-coded yes/no strings to yesno() 2022-02-07 13:04:25 -08:00
drm_color_mgmt.c drm/docs: Document where the C8 color lut is stored 2022-01-25 09:36:20 +01:00
drm_connector.c drm/connector: use drm_sysfs_connector_hotplug_event 2021-11-02 14:27:11 +01:00
drm_context.c
drm_crtc.c
drm_crtc_helper.c
drm_crtc_helper_internal.h drm/dp: Move DP declarations into separate header file 2022-01-17 11:25:44 +01:00
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c drm: Plumb debugfs_init through to panels 2022-02-15 15:25:18 -08:00
drm_debugfs_crc.c
drm_displayid.c
drm_dma.c
drm_drv.c drm: fix null-ptr-deref in drm_dev_init_release() 2021-10-14 21:39:02 +02:00
drm_dsc.c drm/dp: Move public DisplayPort headers into dp/ 2022-01-17 11:25:44 +01:00
drm_dumb_buffers.c
drm_edid.c drm/edid: Clear EDID Deep Color Modes in drm_reset_display_info() 2022-02-02 10:38:28 +01:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb-helper: Clip damage area horizontally 2022-02-10 14:49:31 +01:00
drm_file.c
drm_flip_work.c
drm_format_helper.c drm/format-helper: Add drm_fb_xrgb8888_to_mono_reversed() 2022-02-16 13:29:04 +01:00
drm_fourcc.c drm/fourcc: Add packed 10bit YUV 4:2:0 format 2021-12-16 11:23:22 +01:00
drm_framebuffer.c drm: introduce fb_modifiers_not_supported flag in mode_config 2022-01-31 21:45:23 +01:00
drm_gem.c drm: Convert open-coded yes/no strings to yesno() 2022-02-07 13:04:25 -08:00
drm_gem_atomic_helper.c drm: use new iterator in drm_gem_plane_helper_prepare_fb v3 2021-10-25 09:33:22 +02:00
drm_gem_cma_helper.c drm-misc-next for 5.17: 2021-12-10 15:08:21 +10:00
drm_gem_framebuffer_helper.c dma-buf: move dma-buf symbols into the DMA_BUF module namespace 2021-10-25 14:53:08 +02:00
drm_gem_shmem_helper.c drm/gem-shmem: Don't store mmap'ed buffers in core dumps 2022-02-14 09:42:26 +01:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm: Return error codes from struct drm_driver.gem_create_object 2021-12-02 11:12:39 +01:00
drm_hashtab.c drm: Declare hashtable as legacy 2021-11-30 09:41:28 +01:00
drm_hdcp.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c drm: introduce fb_modifiers_not_supported flag in mode_config 2022-01-31 21:45:23 +01:00
drm_irq.c drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set 2021-10-22 16:20:12 +02:00
drm_kms_helper_common.c drm/dp: Move DisplayPort helpers into separate helper module 2022-01-17 11:25:44 +01:00
drm_lease.c
drm_legacy.h drm: Declare hashtable as legacy 2021-11-30 09:41:28 +01:00
drm_legacy_misc.c
drm_lock.c
drm_managed.c
drm_memory.c
drm_mipi_dbi.c drm/mipi-dbi: Fix source-buffer address in mipi_dbi_buf_copy 2022-01-14 14:43:02 +01:00
drm_mipi_dsi.c
drm_mm.c lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() 2022-01-22 08:33:37 +02:00
drm_mode_config.c
drm_mode_object.c drm/object: Add drm_object_property_get_default_value() function 2022-02-25 17:55:42 +01:00
drm_modes.c drm: Add drm_mode_init() 2022-03-14 17:36:59 +02:00
drm_modeset_helper.c
drm_modeset_lock.c lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() 2022-01-22 08:33:37 +02:00
drm_nomodeset.c drm: Fix build error caused by missing drm_nomodeset.o 2021-11-27 21:05:58 +01:00
drm_of.c drm: of: Lookup if child node has panel or bridge 2022-02-25 17:08:37 +01:00
drm_panel.c
drm_panel_orientation_quirks.c drm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer 2022-01-19 16:31:29 +01:00
drm_pci.c
drm_plane.c drm: add support modifiers for drivers whose planes only support linear layout 2022-01-31 21:45:24 +01:00
drm_plane_helper.c drm/plane-helper: fix uninitialized variable reference 2021-10-07 12:24:44 +02:00
drm_prime.c drm next/fixes for 5.16-rc1 2021-11-12 12:11:07 -08:00
drm_print.c
drm_privacy_screen.c drm/privacy-screen: Fix sphinx warning 2022-02-07 13:43:39 +01:00
drm_privacy_screen_x86.c drm-misc-next for v5.18: 2022-02-01 19:02:41 +10:00
drm_probe_helper.c drm/probe-helper: use drm_kms_helper_connector_hotplug_event 2021-11-02 14:27:14 +01:00
drm_property.c drm: property: Replace strncpy() with strscpy_pad() 2021-10-07 05:42:13 +03:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_syncobj.c drm/syncobj: flatten dma_fence_chains on transfer 2022-02-11 11:30:01 +01:00
drm_sysfs.c drm/sysfs: introduce drm_sysfs_connector_hotplug_event 2021-11-02 14:27:06 +01:00
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c
drm_vm.c
drm_vma_manager.c
drm_writeback.c