summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2023-08-20 11:51:14 +0200
committerAlex Deucher <alexander.deucher@amd.com>2023-08-30 15:26:38 -0400
commita23abe1fbdc16358ca185b4681fef19ec75b79c3 (patch)
tree3f4487ccc4df1d28e5b84e8c4694b8f8d29b06bb /drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
parentff49bd2c74f2e9659c942aff9629b5fcbffed97f (diff)
downloadlinux-stable-a23abe1fbdc16358ca185b4681fef19ec75b79c3.tar.gz
linux-stable-a23abe1fbdc16358ca185b4681fef19ec75b79c3.tar.bz2
linux-stable-a23abe1fbdc16358ca185b4681fef19ec75b79c3.zip
drm/amdgpu: Remove a redundant sanity check
The case where 'num_entries' is too big, is already handled by struct_size(), because kvmalloc() would fail. It will return -ENOMEM instead of -EINVAL, but it is only related to a unlikely to happen sanity check. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index 571fed04eb7a..c8f59a044286 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -78,10 +78,6 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
unsigned i;
int r;
- if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list))
- / sizeof(struct amdgpu_bo_list_entry))
- return -EINVAL;
-
list = kvmalloc(struct_size(list, entries, num_entries), GFP_KERNEL);
if (!list)
return -ENOMEM;