netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] tehuti: return -EFAULT on copy_to_user errors
@ 2010-06-03 10:05 Dan Carpenter
  2010-06-03 10:29 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-06-03 10:05 UTC (permalink / raw)
  To: Alexander Indenbaum
  Cc: Andy Gospodarek, David S. Miller, Jiri Pirko, Stephen Hemminger,
	Eric Dumazet, netdev, kernel-janitors

copy_to_user() returns the number of bytes remaining but we want to
return a negative error code here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 20ab161..737df60 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -646,7 +646,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
 		error = copy_from_user(data, ifr->ifr_data, sizeof(data));
 		if (error) {
 			pr_err("cant copy from user\n");
-			RET(error);
+			RET(-EFAULT);
 		}
 		DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
 	}
@@ -665,7 +665,7 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
 		    data[2]);
 		error = copy_to_user(ifr->ifr_data, data, sizeof(data));
 		if (error)
-			RET(error);
+			RET(-EFAULT);
 		break;
 
 	case BDX_OP_WRITE:

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

* Re: [patch] tehuti: return -EFAULT on copy_to_user errors
  2010-06-03 10:05 [patch] tehuti: return -EFAULT on copy_to_user errors Dan Carpenter
@ 2010-06-03 10:29 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-06-03 10:29 UTC (permalink / raw)
  To: error27
  Cc: baum, andy, jpirko, shemminger, eric.dumazet, netdev,
	kernel-janitors

From: Dan Carpenter <error27@gmail.com>
Date: Thu, 3 Jun 2010 12:05:35 +0200

> copy_to_user() returns the number of bytes remaining but we want to
> return a negative error code here.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.

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

end of thread, other threads:[~2010-06-03 10:29 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:05 [patch] tehuti: return -EFAULT on copy_to_user errors Dan Carpenter
2010-06-03 10:29 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).