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/tegra: Switch over to vmemdup_user()

This patch fixes the following Coccinelle warning:

drivers/gpu/drm/tegra/submit.c:173: WARNING opportunity for vmemdup_user

Use vmemdup_user() rather than duplicating its implementation.
This is a little bit restricted to reduce false positives.

Signed-off-by: Qing Wang <wangqing@vivo.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Qing Wang and committed by
Thierry Reding
bbdca2d4 8935002f

+3 -8
+3 -8
drivers/gpu/drm/tegra/submit.c
··· 169 169 if (copy_len > 0x4000) 170 170 return ERR_PTR(-E2BIG); 171 171 172 - data = kvmalloc(copy_len, GFP_KERNEL); 173 - if (!data) 174 - return ERR_PTR(-ENOMEM); 175 - 176 - if (copy_from_user(data, from, copy_len)) { 177 - kvfree(data); 178 - return ERR_PTR(-EFAULT); 179 - } 172 + data = vmemdup_user(from, copy_len); 173 + if (IS_ERR(data)) 174 + return ERR_CAST(data); 180 175 181 176 return data; 182 177 }