From: Dan Carpenter Date: Sat, 10 Jul 2010 14:30:04 +0000 (+0200) Subject: vmwgfx: return -EFAULT if copy_to_user fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4ede00c96632bcf8a21dd69ac0248f4c40b4cd0e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git vmwgfx: return -EFAULT if copy_to_user fails copy_to_user() returns the number of bytes remaining to be copied, but we want to return a negative error code. This gets copied to user space. Signed-off-by: Dan Carpenter Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index f1d626112415..437ac786277a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -972,6 +972,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, ret = copy_from_user(rects, user_rects, rects_size); if (unlikely(ret != 0)) { DRM_ERROR("Failed to get rects.\n"); + ret = -EFAULT; goto out_free; }