From: dan.carpenter@oracle.com Date: Wed, 19 Jul 2017 09:51:40 +0000 (+0300) Subject: staging: pi433: return -EFAULT if copy_to_user() fails X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=39ae5f1e4b86333b2ca97a278a93640d61fcf77d;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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: 874bcba65f9a ("staging: pi433: New driver") Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index d9328ce5ec1d..416d7ad8e9d7 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -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;