From: Wang Qing <wangqing@xxxxxxxx> fix memdup_user.cocci warning: nouveau_gem.c:630:7-15: WARNING opportunity for vmemdup_user Signed-off-by: Wang Qing <wangqing@xxxxxxxx> --- drivers/gpu/drm/nouveau/nouveau_gem.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 9416bee..befb864 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -627,16 +627,7 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size) size *= nmemb; - mem = kvmalloc(size, GFP_KERNEL); - if (!mem) - return ERR_PTR(-ENOMEM); - - if (copy_from_user(mem, userptr, size)) { - u_free(mem); - return ERR_PTR(-EFAULT); - } - - return mem; + return vmemdup_user(userptr, size); } static int -- 2.7.4