drm/radeon/r600_cs: Fix possible int overflows in r600_cs_check_reg()
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Wed, 29 Nov 2023 15:22:30 +0000 (07:22 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:32 +0000 (15:35 -0800)
commit0413e8869171145d8a53f9d009f59c804b37c7b2
treeaa811a7bdf8cecda5c1c21e8f039d354f5369189
parentd3c0b49aaa12a61d560528f5d605029ab57f0728
drm/radeon/r600_cs: Fix possible int overflows in r600_cs_check_reg()

[ Upstream commit 39c960bbf9d9ea862398759e75736cfb68c3446f ]

While improbable, there may be a chance of hitting integer
overflow when the result of radeon_get_ib_value() gets shifted
left.

Avoid it by casting one of the operands to larger data type (u64).

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

Fixes: 1729dd33d20b ("drm/radeon/kms: r600 CS parser fixes")
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>
drivers/gpu/drm/radeon/r600_cs.c