diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-10-13 04:54:31 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2016-10-17 13:00:11 -0400 |
commit | b2cdeb19f16ad984eb5bb9193f793d05a8101511 (patch) | |
tree | cbad29c7d537e3c72755377460a7b5222f7a35d3 | |
parent | 1001354ca34179f3db924eb66672442a173147dc (diff) |
drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
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: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_gem.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 47a095f392f8..303f23c96220 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c | |||
@@ -544,14 +544,15 @@ vc4_cl_lookup_bos(struct drm_device *dev, | |||
544 | 544 | ||
545 | handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); | 545 | handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t)); |
546 | if (!handles) { | 546 | if (!handles) { |
547 | ret = -ENOMEM; | ||
547 | DRM_ERROR("Failed to allocate incoming GEM handles\n"); | 548 | DRM_ERROR("Failed to allocate incoming GEM handles\n"); |
548 | goto fail; | 549 | goto fail; |
549 | } | 550 | } |
550 | 551 | ||
551 | ret = copy_from_user(handles, | 552 | if (copy_from_user(handles, |
552 | (void __user *)(uintptr_t)args->bo_handles, | 553 | (void __user *)(uintptr_t)args->bo_handles, |
553 | exec->bo_count * sizeof(uint32_t)); | 554 | exec->bo_count * sizeof(uint32_t))) { |
554 | if (ret) { | 555 | ret = -EFAULT; |
555 | DRM_ERROR("Failed to copy in GEM handles\n"); | 556 | DRM_ERROR("Failed to copy in GEM handles\n"); |
556 | goto fail; | 557 | goto fail; |
557 | } | 558 | } |