mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
commitb2cdeb19f1upstream. 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:d5b1a78a77("drm/vc4: Add support for drawing 3D frames.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a63bb198dc
commit
c730a84aff
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user