* [patch 2/2] ip2: return -EFAULT on copy_to_user errors
@ 2010-08-12 7:52 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-08-12 7:52 UTC (permalink / raw)
To: Michael H. Warfield
Cc: Greg Kroah-Hartman, Rakib Mullick, Ben Hutchings, linux-kernel,
kernel-janitors
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@gmail.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;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-12 7:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-12 7:52 [patch 2/2] ip2: return -EFAULT on copy_to_user errors Dan Carpenter
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).