public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Staging: batman-adv: return -EFAULT on copy_to_user errors
@ 2010-06-03 10:04 Dan Carpenter
  2010-06-03 10:22 ` Sven Eckelmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-06-03 10:04 UTC (permalink / raw)
  To: kernel-janitors

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>

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);
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Staging: batman-adv: return -EFAULT on copy_to_user errors
  2010-06-03 10:04 [patch] Staging: batman-adv: return -EFAULT on copy_to_user errors Dan Carpenter
@ 2010-06-03 10:22 ` Sven Eckelmann
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Eckelmann @ 2010-06-03 10:22 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: Text/Plain, Size: 798 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-03 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03 10:04 [patch] Staging: batman-adv: return -EFAULT on copy_to_user errors Dan Carpenter
2010-06-03 10:22 ` Sven Eckelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox