]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
vmwgfx: return an -EFAULT if copy_to_user() fails
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 12 Nov 2012 11:07:24 +0000 (11:07 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 15 Nov 2012 23:53:01 +0000 (09:53 +1000)
copy_to_user() returns the number of bytes remaining to be copied, but
we want to return a negative error code here.  I fixed a couple of these
last year, but I missed this one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c

index b07ca2e4d04b5852c6b59438aaae27bbe478acd2..7290811f89bef5956019f90acc59f543206e49e7 100644 (file)
@@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
        memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
 
        ret = copy_to_user(buffer, bounce, size);
+       if (ret)
+               ret = -EFAULT;
        vfree(bounce);
 
        if (unlikely(ret != 0))