mirror-linux/drivers/gpu/drm/radeon
Ville Syrjälä 606d587759 drm/radeon: 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: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2022-03-15 15:01:12 -04:00
..
reg_srcs
.gitignore
Kconfig
Makefile
ObjectID.h
atom-bits.h
atom-names.h
atom-types.h
atom.c drm: Convert open-coded yes/no strings to yesno() 2022-02-07 13:04:25 -08:00
atom.h
atombios.h gpu: amd: replace open-coded offsetof() with builtin 2021-09-29 17:30:00 -04:00
atombios_crtc.c
atombios_dp.c drm/dp: Move public DisplayPort headers into dp/ 2022-01-17 11:25:44 +01:00
atombios_encoders.c drm/radeon: Fix backlight control on iMac 12,1 2022-02-14 15:08:41 -05:00
atombios_i2c.c
avivod.h
btc_dpm.c
btc_dpm.h
btcd.h
cayman_blit_shaders.c
cayman_blit_shaders.h
ci_dpm.c drm/radeon/ci_dpm: Remove redundant initialization of variables hi_sidd, lo_sidd 2021-09-07 13:30:50 -04:00
ci_dpm.h
ci_smc.c
cik.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
cik.h
cik_blit_shaders.c
cik_blit_shaders.h
cik_reg.h
cik_sdma.c
cikd.h
clearstate_cayman.h
clearstate_ci.h
clearstate_defs.h
clearstate_evergreen.h
clearstate_si.h
cypress_dpm.c
cypress_dpm.h
dce3_1_afmt.c
dce6_afmt.c
dce6_afmt.h
evergreen.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
evergreen.h drm/radeon/evergreen: Remove the repeated declaration 2021-05-25 23:47:24 -04:00
evergreen_blit_shaders.c
evergreen_blit_shaders.h
evergreen_cs.c
evergreen_dma.c
evergreen_hdmi.c
evergreen_hdmi.h
evergreen_reg.h
evergreen_smc.h
evergreend.h
kv_dpm.c
kv_dpm.h
kv_smc.c
mkregtable.c
ni.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
ni.h
ni_dma.c
ni_dpm.c drm/radeon/ni_dpm: Fix booting bug 2021-05-13 10:45:15 -04:00
ni_dpm.h
ni_reg.h
nid.h
nislands_smc.h drm/radeon/ni_dpm: Fix booting bug 2021-05-13 10:45:15 -04:00
ppsmc.h
pptable.h
r100.c drm/radeon: Update pitch for page flip 2021-08-05 21:18:00 -04:00
r100_track.h
r100d.h
r200.c
r300.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
r300_reg.h gpu/drm/radeon: Fix typo in comments 2021-08-02 17:21:25 -04:00
r300d.h
r420.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
r420d.h
r500_reg.h
r520.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
r520d.h
r600.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
r600.h
r600_blit_shaders.c
r600_blit_shaders.h
r600_cs.c drm/radeon/r600_cs: Few typo fixes 2021-04-09 16:44:26 -04:00
r600_dma.c
r600_dpm.c drm/radeon: make array encoded_lanes static 2021-09-23 15:17:28 -04:00
r600_dpm.h
r600_hdmi.c
r600_reg.h
r600d.h
radeon.h drm/radeon: remove resource accounting v2 2022-02-15 17:51:09 +01:00
radeon_acpi.c
radeon_acpi.h
radeon_agp.c drm/radeon: Move AGP data structures into radeon 2021-05-10 15:46:50 +02:00
radeon_asic.c drm/radeon: OLAND boards don't have VCE 2021-02-18 16:43:09 -05:00
radeon_asic.h drm/radeon: remove the repeated declaration 2021-05-25 23:47:30 -04:00
radeon_atombios.c drm/radeon: Avoid power table parsing memory leaks 2021-05-10 18:06:45 -04:00
radeon_atombios.h
radeon_atpx_handler.c
radeon_audio.c
radeon_audio.h
radeon_benchmark.c
radeon_bios.c drm pull for 5.12-rc1 2021-02-21 14:44:44 -08:00
radeon_clocks.c
radeon_combios.c
radeon_connectors.c drm/radeon: Use drm_mode_copy() 2022-03-15 15:01:12 -04:00
radeon_cs.c drm-misc-next for 5.14: 2021-06-10 11:28:09 +10:00
radeon_cursor.c
radeon_device.c drm/radeon: use kernel is_power_of_2 rather than local version 2022-01-14 17:51:13 -05:00
radeon_device.h
radeon_display.c drm: introduce fb_modifiers_not_supported flag in mode_config 2022-01-31 21:45:23 +01:00
radeon_dp_auxch.c
radeon_dp_mst.c drm/dp: Move public DisplayPort headers into dp/ 2022-01-17 11:25:44 +01:00
radeon_drv.c drm: Move nomodeset kernel parameter to the DRM subsystem 2021-11-27 13:52:22 +01:00
radeon_drv.h
radeon_encoders.c
radeon_family.h
radeon_fb.c drm/radeon: Add break to switch statement in radeonfb_create_pinned_object() 2021-08-16 16:14:12 -04:00
radeon_fence.c Merge drm/drm-next into drm-misc-next 2021-09-14 09:25:30 +02:00
radeon_gart.c drm/radeon: use the dummy page for GART if needed 2021-05-19 22:32:24 -04:00
radeon_gem.c dma-buf-map: Rename to iosys-map 2022-02-07 16:35:35 -08:00
radeon_i2c.c
radeon_ib.c drm/radeon: do not use drm middle layer for debugfs (v2) 2021-02-18 16:43:10 -05:00
radeon_irq_kms.c drm/radeon: Convert to Linux IRQ interfaces 2021-08-10 20:13:49 +02:00
radeon_kms.c drm/radeon: remove resource accounting v2 2022-02-15 17:51:09 +01:00
radeon_kms.h drm/radeon: Convert to Linux IRQ interfaces 2021-08-10 20:13:49 +02:00
radeon_legacy_crtc.c
radeon_legacy_encoders.c
radeon_legacy_encoders.h
radeon_legacy_tv.c
radeon_mn.c dma-buf: drop the _rcu postfix on function names v3 2021-06-06 11:19:51 +02:00
radeon_mode.h drm/dp: Move public DisplayPort headers into dp/ 2022-01-17 11:25:44 +01:00
radeon_object.c drm-misc-next for v5.18: 2022-02-25 05:50:18 +10:00
radeon_object.h drm/radeon: remove resource accounting v2 2022-02-15 17:51:09 +01:00
radeon_pm.c drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
radeon_pm.h
radeon_prime.c drm/radeon: wait for moving fence after pinning 2021-06-22 15:29:03 +02:00
radeon_prime.h
radeon_reg.h
radeon_ring.c drm/radeon: do not use drm middle layer for debugfs (v2) 2021-02-18 16:43:10 -05:00
radeon_sa.c
radeon_semaphore.c
radeon_sync.c drm/radeon: use new iterator in radeon_sync_resv 2021-10-20 14:07:54 +02:00
radeon_test.c
radeon_trace.h drm/ttm: rename bo->mem and make it a pointer 2021-06-02 11:07:25 +02:00
radeon_trace_points.c
radeon_ttm.c drm/radeon: remove resource accounting v2 2022-02-15 17:51:09 +01:00
radeon_ttm.h drm/radeon: Implement mmap as GEM object function 2021-05-26 20:56:29 +02:00
radeon_ucode.c
radeon_ucode.h
radeon_uvd.c Linux 5.17-rc6 2022-02-28 14:57:14 +10:00
radeon_vce.c drm/radeon: Fix syntax errors in comments 2021-12-14 16:11:02 -05:00
radeon_vm.c gpu/drm/radeon: Fix typo in comments 2021-08-02 17:21:25 -04:00
rs100d.h
rs400.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
rs400d.h
rs600.c drm/radeon: Update pitch for page flip 2021-08-05 21:18:00 -04:00
rs600d.h
rs690.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
rs690d.h
rs780_dpm.c
rs780_dpm.h
rs780d.h
rv6xx_dpm.c
rv6xx_dpm.h
rv6xxd.h
rv200d.h
rv250d.h
rv350d.h
rv515.c drm/radeon: delete useless function return values & remove meaningless if(r) check code 2021-06-22 16:51:45 -04:00
rv515d.h
rv730_dpm.c
rv730d.h
rv740_dpm.c
rv740d.h
rv770.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
rv770.h
rv770_dma.c
rv770_dpm.c
rv770_dpm.h
rv770_smc.c
rv770_smc.h
rv770d.h
si.c drm/radeon: fix UVD suspend error 2022-01-18 17:43:36 -05:00
si.h
si_blit_shaders.c
si_blit_shaders.h
si_dma.c
si_dpm.c drm/radeon/dpm: Disable sclk switching on Oland when two 4K 60Hz monitors are connected 2021-05-19 22:29:40 -04:00
si_dpm.h
si_reg.h
si_smc.c
sid.h
sislands_smc.h drm/radeon/si_dpm: Fix SMU power state load 2021-05-13 10:45:29 -04:00
smu7.h
smu7_discrete.h
smu7_fusion.h
sumo_dpm.c
sumo_dpm.h
sumo_smc.c
sumod.h
trinity_dpm.c
trinity_dpm.h
trinity_smc.c
trinityd.h
uvd_v1_0.c
uvd_v2_2.c
uvd_v3_1.c
uvd_v4_2.c
vce.h
vce_v1_0.c drm/radeon: OLAND boards don't have VCE 2021-02-18 16:43:09 -05:00
vce_v2_0.c