Skip to content

Commit 9c43eb1

Browse files
committed
vinput: Fix incorrect handling on raw_copy_to_user() failure
When raw_copy_to_user() failed in vinput_read(), the function would set 'count' to -EFAULT and then subtract EFAULT from '*offset'. However, modifying '*offset' on raw_copy_to_user() failure was incorrect. Fix this behavior by changing count = -EFAULT to return -EFAULT.
1 parent d63f263 commit 9c43eb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/vinput.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static ssize_t vinput_read(struct file *file, char __user *buffer, size_t count,
106106
count = len - *offset;
107107

108108
if (raw_copy_to_user(buffer, buff + *offset, count))
109-
count = -EFAULT;
109+
return -EFAULT;
110110

111111
*offset += count;
112112

0 commit comments

Comments
 (0)