From: Dan Carpenter Date: Thu, 3 Jun 2010 00:05:35 +0000 (+0000) Subject: tehuti: return -EFAULT on copy_to_user errors X-Git-Tag: v2.6.35-rc2~4^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d23380701876dd93d310b2548c51d0f78f25d7aa;p=platform%2Fkernel%2Flinux-3.10.git tehuti: return -EFAULT on copy_to_user errors copy_to_user() returns the number of bytes remaining but we want to return a negative error code here. Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- 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: