Skip to content

Commit

Permalink
drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
Browse files Browse the repository at this point in the history
If the allocation fails the current code returns success.  If
copy_from_user() fails it returns the number of bytes remaining instead
of -EFAULT.

Fixes: d5b1a78 ("drm/vc4: Add support for drawing 3D frames.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
  • Loading branch information
Dan Carpenter authored and Eric Anholt committed Oct 17, 2016

Unverified

No user is associated with the committer email.
1 parent 1001354 commit b2cdeb1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/vc4/vc4_gem.c
Original file line number Diff line number Diff line change
@@ -544,14 +544,15 @@ vc4_cl_lookup_bos(struct drm_device *dev,

handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t));
if (!handles) {
ret = -ENOMEM;
DRM_ERROR("Failed to allocate incoming GEM handles\n");
goto fail;
}

ret = copy_from_user(handles,
(void __user *)(uintptr_t)args->bo_handles,
exec->bo_count * sizeof(uint32_t));
if (ret) {
if (copy_from_user(handles,
(void __user *)(uintptr_t)args->bo_handles,
exec->bo_count * sizeof(uint32_t))) {
ret = -EFAULT;
DRM_ERROR("Failed to copy in GEM handles\n");
goto fail;
}

0 comments on commit b2cdeb1

Please sign in to comment.