Staging: batman-adv: return -EFAULT on copy_to_user errors
authorDan Carpenter <error27@gmail.com>
Sun, 6 Jun 2010 19:03:04 +0000 (21:03 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jun 2010 22:31:52 +0000 (15:31 -0700)
copy_to_user() returns the number of bites remaining but we want to
return a negative error code here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/batman-adv/device.c

index 7eb6559e03158d07eada6eccddf882ddaa2ec537..32204b5572d0c8e78a34b89c69a04c6d11cb762c 100644 (file)
@@ -196,7 +196,7 @@ ssize_t bat_device_read(struct file *file, char __user *buf, size_t count,
        kfree(device_packet);
 
        if (error)
-               return error;
+               return -EFAULT;
 
        return sizeof(struct icmp_packet);
 }