]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
staging: pi433: return -EFAULT if copy_to_user() fails
authordan.carpenter@oracle.com <dan.carpenter@oracle.com>
Wed, 19 Jul 2017 09:51:40 +0000 (12:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Jul 2017 23:55:40 +0000 (16:55 -0700)
copy_to_user() to user returns the number of bytes that weren't copied,
but we should be returning -EFAULT to the user.

Fixes: 874bcba65f9a ("staging: pi433: New driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/pi433/pi433_if.c

index d9328ce5ec1d3f7529a775a64dfc6e341cb8acaa..416d7ad8e9d7ad9326ab523e278ab9c1e1d7919e 100644 (file)
@@ -689,7 +689,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
        {
                retval = copy_to_user(buf, device->rx_buffer, bytes_received);
                if (retval)
-                       return retval;
+                       return -EFAULT;
        }
 
        return bytes_received;