Skip to contentSkip to conversation

usb: iowarrior: fix misuse of return value of copy_to_user()

PATCH Superseded Kulikov Vasiliy 1 participant 1 message Jul 31, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/7 usb: iowarrior: fix misuse of return value of copy_to_user()

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

---
 drivers/usb/misc/iowarrior.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/misc/iowarrior.c +2 -2
index 2de49c8..bc88c79 100644
@@ -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;
 		}
Signature · 1 line
1.7.0.4