Commit 1865a9c3 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by Greg Kroah-Hartman

USB: adutux: 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 6d4d4554
......@@ -439,7 +439,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
/* drain secondary buffer */
int amount = bytes_to_read < data_in_secondary ? bytes_to_read : data_in_secondary;
i = copy_to_user(buffer, dev->read_buffer_secondary+dev->secondary_head, amount);
if (i < 0) {
if (i) {
retval = -EFAULT;
goto exit;
}
......
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