Commit 585cb132 authored by Dan Carpenter's avatar Dan Carpenter Committed by Eric Anholt

drm/vc4: Return -EFAULT on copy_from_user() failure

The copy_from_user() function returns the number of bytes not copied but
we want to return a negative error code.

Fixes: 463873d5 ('drm/vc4: Add an API for creating GPU shaders in GEM BOs.')
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 0b06e0a7
...@@ -499,11 +499,12 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, ...@@ -499,11 +499,12 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
if (IS_ERR(bo)) if (IS_ERR(bo))
return PTR_ERR(bo); return PTR_ERR(bo);
ret = copy_from_user(bo->base.vaddr, if (copy_from_user(bo->base.vaddr,
(void __user *)(uintptr_t)args->data, (void __user *)(uintptr_t)args->data,
args->size); args->size)) {
if (ret != 0) ret = -EFAULT;
goto fail; goto fail;
}
/* Clear the rest of the memory from allocating from the BO /* Clear the rest of the memory from allocating from the BO
* cache. * cache.
*/ */
......
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