[patch] Staging: batman-adv: return -EFAULT on copy_to_user errors

Sven Eckelmann sven.eckelmann at gmx.de
Thu Jun 3 10:22:47 UTC 2010


Dan Carpenter wrote:
> 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 at gmail.com>
> 
> diff --git a/drivers/staging/batman-adv/device.c
> b/drivers/staging/batman-adv/device.c index ad82ec4..c7f3978 100644
> --- a/drivers/staging/batman-adv/device.c
> +++ b/drivers/staging/batman-adv/device.c
> @@ -196,7 +196,7 @@ ssize_t bat_device_read(struct file *file, char __user
> *buf, size_t count, kfree(device_packet);
> 
>  	if (error)
> -		return error;
> +		return -EFAULT;
> 
>  	return sizeof(struct icmp_packet);
>  }

Thanks for your patch, but this collides with a patch currently waiting in 
GregKH's queue. I will port that patch on top of that.

Best regards,
	Sven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20100603/8cce6fc4/attachment.asc>


More information about the devel mailing list