Skip to content

Commit 335f1e7

Browse files
Dan Carpenteralexdeucher
authored andcommitted
drm/amdgpu: Fix integer overflow in amdgpu_gem_add_input_fence()
The "num_syncobj_handles" is a u32 value that comes from the user via the ioctl. On 32bit systems the "sizeof(uint32_t) * num_syncobj_handles" multiplication can have an integer overflow. Use size_mul() to fix that. Fixes: 38c67ec ("drm/amdgpu: Add input fence to sync bo map/unmap") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 98a46a4 commit 335f1e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ amdgpu_gem_add_input_fence(struct drm_file *filp,
5858
return 0;
5959

6060
syncobj_handles = memdup_user(u64_to_user_ptr(syncobj_handles_array),
61-
sizeof(uint32_t) * num_syncobj_handles);
61+
size_mul(sizeof(uint32_t), num_syncobj_handles));
6262
if (IS_ERR(syncobj_handles))
6363
return PTR_ERR(syncobj_handles);
6464

0 commit comments

Comments
 (0)