Commit bbdca2d4 authored by Qing Wang's avatar Qing Wang Committed by Thierry Reding

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: default avatarQing Wang <wangqing@vivo.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 8935002f
......@@ -169,14 +169,9 @@ static void *alloc_copy_user_array(void __user *from, size_t count, size_t size)
if (copy_len > 0x4000)
return ERR_PTR(-E2BIG);
data = kvmalloc(copy_len, GFP_KERNEL);
if (!data)
return ERR_PTR(-ENOMEM);
if (copy_from_user(data, from, copy_len)) {
kvfree(data);
return ERR_PTR(-EFAULT);
}
data = vmemdup_user(from, copy_len);
if (IS_ERR(data))
return ERR_CAST(data);
return data;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment