USB: iowarrior: fix misuse of return value of copy_to_user()
authorKulikov Vasiliy <segooon@gmail.com>
Sat, 31 Jul 2010 17:39:46 +0000 (21:39 +0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Aug 2010 03:50:16 +0000 (20:50 -0700)
copy_to_user() returns number of not copied bytes, not error code.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/iowarrior.c

index 2de49c8887c5f772b0f166cc7b98354f4ad902ea..bc88c79875a146712cae5fcb7461325501f20ad7 100644 (file)
@@ -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;
                }