[PATCH] staging: pi433: return -EFAULT if copy_to_user() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 1bc478a7f49e..d49c152d52f8 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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux