Commit 6d4d4554 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by Greg Kroah-Hartman

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

copy_to_user() returns number of not copied bytes, not error code.
Signed-off-by: default avatarKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 14184f9b
...@@ -542,7 +542,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, ...@@ -542,7 +542,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
retval = io_res; retval = io_res;
else { else {
io_res = copy_to_user(user_buffer, buffer, dev->report_size); io_res = copy_to_user(user_buffer, buffer, dev->report_size);
if (io_res < 0) if (io_res)
retval = -EFAULT; retval = -EFAULT;
} }
break; break;
...@@ -574,7 +574,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, ...@@ -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, io_res = copy_to_user((struct iowarrior_info __user *)arg, &info,
sizeof(struct iowarrior_info)); sizeof(struct iowarrior_info));
if (io_res < 0) if (io_res)
retval = -EFAULT; retval = -EFAULT;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment