vmwgfx: return -EFAULT if copy_to_user fails
authorDan Carpenter <error27@gmail.com>
Sat, 10 Jul 2010 14:30:04 +0000 (16:30 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Jul 2010 05:24:11 +0000 (15:24 +1000)
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 <error27@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c

index f1d62611241586f73115a0a8cd60f853837308f6..437ac786277a22520ec9fca32f1488ab6bcdcab4 100644 (file)
@@ -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;
        }