mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 6/7] usb: iowarrior: fix misuse of return value of copy_to_user()
@ 2010-07-31 17:39 Kulikov Vasiliy
  0 siblings, 0 replies; only message in thread
From: Kulikov Vasiliy @ 2010-07-31 17:39 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Greg Kroah-Hartman, Oliver Neukum, Mauro Carvalho Chehab,
	Daniel Mack, Kay Sievers, linux-usb, linux-kernel

copy_to_user() returns number of not copied bytes, not error code.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/usb/misc/iowarrior.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 2de49c8..bc88c79 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -542,7 +542,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
 			retval = io_res;
 		else {
 			io_res = copy_to_user(user_buffer, buffer, dev->report_size);
-			if (io_res < 0)
+			if (io_res)
 				retval = -EFAULT;
 		}
 		break;
@@ -574,7 +574,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
 			}
 			io_res = copy_to_user((struct iowarrior_info __user *)arg, &info,
 					 sizeof(struct iowarrior_info));
-			if (io_res < 0)
+			if (io_res)
 				retval = -EFAULT;
 			break;
 		}
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-31 17:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-31 17:39 [PATCH 6/7] usb: iowarrior: fix misuse of return value of copy_to_user() Kulikov Vasiliy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®