summary refs log tree commit diff
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorhackyzh002 <hackyzh002@gmail.com>2023-04-19 20:22:33 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-23 17:52:19 +0200
commit9f55d300541cb5b435984d269087810581580b00 (patch)
treec1626f99e9956182b1c3cf0cbd3eb19df79ac80f /drivers/gpu/drm/amd
parentab6f446c220db0c131f2071846afd835799be0fb (diff)
downloadlinux-9f55d300541cb5b435984d269087810581580b00.tar.gz
drm/amdgpu: Fix integer overflow in amdgpu_cs_pass1
[ Upstream commit 87c2213e85bd81e4a9a4d0880c256568794ae388 ]

The type of size is unsigned int, if size is 0x40000000, there will
be an integer overflow, size will be zero after size *= sizeof(uint32_t),
will cause uninitialized memory to be referenced later.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: hackyzh002 <hackyzh002@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index fdb53d4394f3..6d3d01c5f0a2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -185,7 +185,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p,
 	uint64_t *chunk_array_user;
 	uint64_t *chunk_array;
 	uint32_t uf_offset = 0;
-	unsigned int size;
+	size_t size;
 	int ret;
 	int i;