bianbu-linux-6.6/drivers/gpu/drm/msm
Ville Syrjälä b2a1c5ca50 drm/msm: 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: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221107192545.9896-5-ville.syrjala@linux.intel.com
2022-11-12 01:41:25 +02:00
..
adreno drm/msm/a6xx: Handle GMU prepare-slumber hfi failure 2022-09-01 08:06:55 -07:00
disp drm/msm: Use drm_mode_init() for on-stack modes 2022-11-12 01:41:13 +02:00
dp drm/msm: Use drm_mode_copy() 2022-11-12 01:41:25 +02:00
dsi drm/msm/dsi: Remove use of device_node in dsi_host_parse_dt() 2022-09-18 09:38:06 -07:00
hdmi drm/msm/hdmi: make hdmi_phy_8996 OF clk provider 2022-09-18 09:38:07 -07:00
Kconfig Merge tag 'drm-msm-next-2022-05-09' of https://gitlab.freedesktop.org/drm/msm into drm-next 2022-05-11 12:40:47 +10:00
Makefile drm/msm/dp: rewrite dss_module_power to use bulk clock functions 2022-07-04 21:05:28 +03:00
msm_atomic.c drm/msm: Avoid dirtyfb stalls on video mode displays (v2) 2022-02-25 07:59:58 -08:00
msm_atomic_trace.h
msm_atomic_tracepoints.c
msm_debugfs.c drm/msm: Add fault-injection support 2022-08-28 08:32:11 -07:00
msm_debugfs.h
msm_drv.c Merge tag 'drm-msm-next-2022-09-22' of https://gitlab.freedesktop.org/drm/msm into drm-next 2022-09-28 11:35:25 +10:00
msm_drv.h Merge tag 'drm-msm-next-2022-09-22' of https://gitlab.freedesktop.org/drm/msm into drm-next 2022-09-28 11:35:25 +10:00
msm_fb.c drm: Drop drm_framebuffer.h from drm_crtc.h 2022-06-20 23:53:55 +03:00
msm_fbdev.c drm/fb-helper: Rename drm_fb_helper_unregister_fbi() to use _info postfix 2022-11-05 17:05:54 +01:00
msm_fence.c drm/msm: Fix fence rollover issue 2022-07-05 06:01:11 +03:00
msm_fence.h drm/msm/gem: Add fenced vma unpin 2022-04-21 15:03:12 -07:00
msm_gem.c drm/msm/gem: Add msm_gem_assert_locked() 2022-08-27 09:32:45 -07:00
msm_gem.h drm/msm/gem: Convert to lockdep assert 2022-08-28 08:31:49 -07:00
msm_gem_prime.c drm/msm/gem: Rename to pin/unpin_pages 2022-08-27 09:32:44 -07:00
msm_gem_shrinker.c drm/msm: Fix build break with recent mm tree 2022-09-30 10:13:49 +10:00
msm_gem_submit.c drm/msm/gem: Unpin buffers earlier 2022-08-27 09:32:45 -07:00
msm_gem_vma.c drm/msm/gem: Drop early returns in close/purge vma 2022-06-15 13:22:45 -07:00
msm_gpu.c drm/msm/a6xx: Ensure CX collapse during gpu recovery 2022-08-28 09:29:27 -07:00
msm_gpu.h drm/msm/a6xx: Ensure CX collapse during gpu recovery 2022-08-28 09:29:27 -07:00
msm_gpu_devfreq.c drm/msm/gpu: Drop qos request if devm_devfreq_add_device() fails 2022-09-18 09:37:55 -07:00
msm_gpu_trace.h drm/msm/gem: Evict active GEM objects when necessary 2022-08-27 09:32:45 -07:00
msm_gpu_tracepoints.c
msm_gpummu.c
msm_io_utils.c drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices 2022-09-18 09:38:02 -07:00
msm_iommu.c drm/msm/iommu: optimize map/unmap 2022-08-28 08:32:12 -07:00
msm_kms.h drm/msm: don't free the IRQ if it was not requested 2022-05-18 15:55:46 -07:00
msm_mdss.c drm/msm/dpu: Move min BW request and full BW disable back to mdss 2022-06-01 16:16:19 -07:00
msm_mmu.h
msm_perf.c drm/msm: Remove struct_mutex usage 2021-11-28 09:50:33 -08:00
msm_rd.c drm/msm/rd: Fix FIFO-full deadlock 2022-09-18 09:37:55 -07:00
msm_ringbuffer.c drm/msm: Remove unnecessary pm_runtime_get/put 2022-08-28 09:29:27 -07:00
msm_ringbuffer.h drm/msm/gpu: Drop duplicate fence counter 2022-04-21 15:03:11 -07:00
msm_submitqueue.c drm/msm: Split out idr_lock 2022-08-27 09:32:44 -07:00
NOTES