Commit 39ae5f1e authored by dan.carpenter@oracle.com's avatar dan.carpenter@oracle.com Committed by Greg Kroah-Hartman

staging: pi433: return -EFAULT if copy_to_user() fails

copy_to_user() to user returns the number of bytes that weren't copied,
but we should be returning -EFAULT to the user.

Fixes: 874bcba6 ("staging: pi433: New driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a7b1ba23
...@@ -689,7 +689,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos) ...@@ -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); retval = copy_to_user(buf, device->rx_buffer, bytes_received);
if (retval) if (retval)
return retval; return -EFAULT;
} }
return bytes_received; return bytes_received;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment