[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20100812075236.GM645@bicker>
Date: Thu, 12 Aug 2010 09:52:36 +0200
From: Dan Carpenter <error27@...il.com>
To: "Michael H. Warfield" <mhw@...tsend.com>
Cc: Greg Kroah-Hartman <gregkh@...e.de>,
Rakib Mullick <rakib.mullick@...il.com>,
Ben Hutchings <ben@...adent.org.uk>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch 2/2] ip2: 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 on errors.
Signed-off-by: Dan Carpenter <error27@...il.com>
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 8fa041e..d4b71e8 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -2930,6 +2930,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
if ( pCh )
{
rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
+ if (rc)
+ rc = -EFAULT;
} else {
rc = -ENODEV;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists