Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm: remove some dead code

This is supposed to test for integer overflow but it is wrong and
unnecessary. The size_add()/mul() macros return SIZE_MAX when there is
an integer overflow. This code saves the SIZE_MAX to a u64 and then
tests if the result is greater than SIZE_MAX which it never will be.
Fortunately, when we try to allocate SIZE_MAX bytes the allocation
will fail. We even pass __GFP_NOWARN so the allocation fails
harmlessly and quietly.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/697596/
Link: https://lore.kernel.org/r/aWAMIhZLxUcecbLd@stanley.mountain
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

authored by

Dan Carpenter and committed by
Dmitry Baryshkov
37d2e108 1338e8ae

+1 -7
+1 -7
drivers/gpu/drm/msm/msm_gem_vma.c
··· 950 950 struct msm_gpu_submitqueue *queue, uint32_t nr_ops) 951 951 { 952 952 struct msm_vm_bind_job *job; 953 - uint64_t sz; 954 953 int ret; 955 954 956 - sz = struct_size(job, ops, nr_ops); 957 - 958 - if (sz > SIZE_MAX) 959 - return ERR_PTR(-ENOMEM); 960 - 961 - job = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN); 955 + job = kzalloc(struct_size(job, ops, nr_ops), GFP_KERNEL | __GFP_NOWARN); 962 956 if (!job) 963 957 return ERR_PTR(-ENOMEM); 964 958