From error27@gmail.com Fri Jun 4 09:50:35 2010 From: Dan Carpenter Date: Fri, 4 Jun 2010 12:39:51 +0200 Subject: Staging: rc2860: return -EFAULT on copy_to_user errors To: Greg Kroah-Hartman Cc: Bartlomiej Zolnierkiewicz , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Message-ID: <20100604103951.GE5483@bicker> Content-Disposition: inline copy_to_user() returns the number of bytes remaining but we want to return a negative error code. This is in the ioctl handler and the error code gets passed to userspace. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rt2860/sta_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/staging/rt2860/sta_ioctl.c +++ b/drivers/staging/rt2860/sta_ioctl.c @@ -2522,6 +2522,8 @@ int rt28xx_sta_ioctl(IN struct net_devic Status = copy_to_user(erq->pointer, pAd->nickname, erq->length); + if (Status) + Status = -EFAULT; break; } case SIOCGIWRATE: /*get default bit rate (bps) */