Skip to contentSkip to conversation

usb: adutux: fix misuse of return value of copy_to_user()

PATCH Superseded Kulikov Vasiliy 1 participant 1 message Jul 31, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 usb: adutux: fix misuse of return value of copy_to_user()

copy_to_user() returns number of not copied bytes, not error code.

---
 drivers/usb/misc/adutux.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/misc/adutux.c +1 -1
index d240de0..801324a 100644
@@ -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;
 			}
Signature · 1 line
1.7.0.4