summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohui Zhang <xiaohuizhang@ruc.edu.cn>2022-06-07 23:36:31 +0800
committerAlex Deucher <alexander.deucher@amd.com>2022-06-08 11:40:41 -0400
commitfeb54650bae25f2a2adfc493e3e254e7c27a3fba (patch)
tree222796f50528fe3fcbf35591ff58457e4a0c92ce
parentc4d7738c9efc81a4f0364da1e673ab1b1cf91735 (diff)
downloadlinux-feb54650bae25f2a2adfc493e3e254e7c27a3fba.tar.gz
drm/radeon: integer overflow in radeon_mode_dumb_create()
Similar to the handling of amdgpu_mode_dumb_create in commit 54ef0b5461c0 ("drm/amdgpu: integer overflow in amdgpu_mode_dumb_create()"), we thought a patch might be needed here as well. args->size is a u64. arg->pitch and args->height are u32. The multiplication will overflow instead of using the high 32 bits as intended. Signed-off-by: Xiaohui Zhang <xiaohuizhang@ruc.edu.cn> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 8c01a7f0e027..84843b3b3aef 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -833,7 +833,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
args->pitch = radeon_align_pitch(rdev, args->width,
DIV_ROUND_UP(args->bpp, 8), 0);
- args->size = args->pitch * args->height;
+ args->size = (u64)args->pitch * args->height;
args->size = ALIGN(args->size, PAGE_SIZE);
r = radeon_gem_object_create(rdev, args->size, 0,