Skip to content

Commit

Permalink
Staging: batman-adv: return -EFAULT on copy_to_user errors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 30, 2010
1 parent f2102d3 commit 25477f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/batman-adv/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 25477f2

Please sign in to comment.