Skip to content

Commit

Permalink
USB: adutux: 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 6d4d455 commit 1865a9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1865a9c

Please sign in to comment.