]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 11 Oct 2023 08:01:48 +0000 (11:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:20 +0000 (11:08 +0100)
commite588ca45bf55a28ce589616899b77bf4119b7ada
tree64ced8adaf45441522980b68742f08cf8d7835d2
parenta00a293d57a56053d25884e6182f6a0d388d154d
drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map()

[ Upstream commit 6471da5ee311d53ef46eebcb7725bc94266cc0cf ]

The "ret" variable is declared as ssize_t and it can hold negative error
codes but the "rk_obj->base.size" variable is type size_t.  This means
that when we compare them, they are both type promoted to size_t and the
negative error code becomes a high unsigned value and is treated as
success.  Add a cast to fix this.

Fixes: 38f993b7c59e ("drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/2bfa28b5-145d-4b9e-a18a-98819dd686ce@moroto.mountain
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/rockchip/rockchip_drm_gem.c