batman-adv: return -EFAULT on copy_to_user errors
Commit Message
From: Dan Carpenter <error27@gmail.com>
copy_to_user() returns the number of bites remaining but we want to
return a negative error code here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
[sven.eckelmann@gmx.de: Move change from device.c to icmp_socket.c]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
This patch is already applied in maint and must be applied in master.
batman-adv-kernelland/icmp_socket.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Comments
Thank you, applied in svn r1689.
On Thu, Jun 03, 2010 at 01:33:27PM +0200, Sven Eckelmann wrote:
> From: Dan Carpenter <error27@gmail.com>
>
> copy_to_user() returns the number of bites remaining but we want to
> return a negative error code here.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> [sven.eckelmann@gmx.de: Move change from device.c to icmp_socket.c]
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> ---
> This patch is already applied in maint and must be applied in master.
>
> batman-adv-kernelland/icmp_socket.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/batman-adv-kernelland/icmp_socket.c b/batman-adv-kernelland/icmp_socket.c
> index bad87fd..08cca22 100644
> --- a/batman-adv-kernelland/icmp_socket.c
> +++ b/batman-adv-kernelland/icmp_socket.c
> @@ -148,7 +148,7 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
> kfree(socket_packet);
>
> if (error)
> - return error;
> + return -EFAULT;
>
> return packet_len;
> }
> --
> 1.7.1
>
>
@@ -148,7 +148,7 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
kfree(socket_packet);
if (error)
- return error;
+ return -EFAULT;
return packet_len;
}