Skip to content

Commit

Permalink
USB: iowarrior: fix misuse of return value of copy_to_user()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kulikov Vasiliy authored and Greg Kroah-Hartman committed Aug 24, 2010
1 parent 14184f9 commit 6d4d455
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6d4d455

Please sign in to comment.