提交 6d4d4554 编写于 作者: K Kulikov Vasiliy 提交者: 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: NKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 14184f9b
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册