kernel_samsung_a53x/drivers/gpu/drm/radeon
Nikita Zhandarovich a339df473d drm/radeon/evergreen_cs: fix int overflow errors in cs track offsets
[ Upstream commit 3fbaf475a5b8361ebee7da18964db809e37518b7 ]

Several cs track offsets (such as 'track->db_s_read_offset')
either are initialized with or plainly take big enough values that,
once shifted 8 bits left, may be hit with integer overflow if the
resulting values end up going over u32 limit.

Same goes for a few instances of 'surf.layer_size * mslice'
multiplications that are added to 'offset' variable - they may
potentially overflow as well and need to be validated properly.

While some debug prints in this code section take possible overflow
issues into account, simply casting to (unsigned long) may be
erroneous in its own way, as depending on CPU architecture one is
liable to get different results.

Fix said problems by:
 - casting 'offset' to fixed u64 data type instead of
 ambiguous unsigned long.
 - casting one of the operands in vulnerable to integer
 overflow cases to u64.
 - adjust format specifiers in debug prints to properly
 represent 'offset' values.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: 285484e2d55e ("drm/radeon: add support for evergreen/ni tiling informations v11")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:21:21 +01:00
..
reg_srcs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atom-bits.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atom-names.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atom-types.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atom.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atombios.h drm/radeon: Replace one-element array with flexible-array member 2024-11-23 23:21:21 +01:00
atombios_crtc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atombios_dp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atombios_encoders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atombios_i2c.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
avivod.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btc_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btc_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btcd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cayman_blit_shaders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cayman_blit_shaders.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ci_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ci_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ci_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cik.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cik_blit_shaders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cik_blit_shaders.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cik_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cik_sdma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cikd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clearstate_cayman.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clearstate_ci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clearstate_defs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clearstate_evergreen.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clearstate_si.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cypress_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cypress_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dce3_1_afmt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dce6_afmt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen.c drm/radeon: possible buffer overflow 2024-11-18 11:42:55 +01:00
evergreen_blit_shaders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen_blit_shaders.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen_cs.c drm/radeon/evergreen_cs: fix int overflow errors in cs track offsets 2024-11-23 23:21:21 +01:00
evergreen_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen_hdmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreen_smc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
evergreend.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kv_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kv_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kv_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mkregtable.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ni.c drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode() 2024-11-19 08:44:53 +01:00
ni_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ni_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ni_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ni_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nislands_smc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ObjectID.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ppsmc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pptable.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r100.c drm/radeon/r100: Fix integer overflow issues in r100_cs_track_check() 2024-11-18 12:12:39 +01:00
r100_track.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r100d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r200.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r300.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r300_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r300d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r420.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r420d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r500_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r520.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r520d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_blit_shaders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_blit_shaders.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_cs.c drm/radeon/r600_cs: Fix possible int overflows in r600_cs_check_reg() 2024-11-18 12:12:39 +01:00
r600_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_hdmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r600d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon.h drm/radeon/radeon_display: Decrease the size of allocated memory 2024-11-19 14:19:32 +01:00
radeon_acpi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_acpi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_agp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_asic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_asic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_atombios.c drm/radeon: properly handle vbios fake edid sizing 2024-11-23 23:21:21 +01:00
radeon_atpx_handler.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_audio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_audio.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_benchmark.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_bios.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_clocks.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_combios.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_connectors.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_cs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_cursor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_device.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_display.c drm/radeon/radeon_display: Decrease the size of allocated memory 2024-11-19 14:19:32 +01:00
radeon_dp_auxch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_dp_mst.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_drv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_drv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_encoders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_family.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_fb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_fence.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_gart.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_gem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_i2c.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_ib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_irq_kms.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_kms.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_legacy_crtc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_legacy_encoders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_legacy_tv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_mn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_mode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_object.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_object.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_pm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_prime.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_ring.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_sa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_semaphore.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_sync.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_test.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_trace_points.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_ttm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_ucode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_ucode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_uvd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_vce.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
radeon_vm.c gpu/drm/radeon: fix two memleaks in radeon_vm_init 2024-11-18 12:12:41 +01:00
rs100d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs400.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs400d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs600.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs600d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs690.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs690d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs780_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs780_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rs780d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv6xx_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv6xx_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv6xxd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv200d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv250d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv350d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv515.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv515d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv730_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv730d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv740_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv740d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770_smc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rv770d.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si.c drm/radeon: check return value of radeon_ring_lock() 2024-11-18 12:12:39 +01:00
si_blit_shaders.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_blit_shaders.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_dpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
si_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sislands_smc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smu7.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smu7_discrete.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smu7_fusion.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sumo_dpm.c drm/radeon: fix UBSAN warning in kv_dpm.c 2024-11-19 14:19:09 +01:00
sumo_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sumo_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sumod.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trinity_dpm.c drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table 2024-11-18 12:12:40 +01:00
trinity_dpm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trinity_smc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trinityd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uvd_v1_0.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uvd_v2_2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uvd_v3_1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uvd_v4_2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vce_v1_0.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vce_v2_0.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00