From: Stefan Achatz Date: Thu, 6 Jan 2011 08:00:41 +0000 (+0100) Subject: HID: roccat: Fix an error message when reading more data from bin attributes X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fd82be6c0a359fc706a805a49b1f167af21e63ea;p=linux-beck.git HID: roccat: Fix an error message when reading more data from bin attributes Using cat or something to read from binary attributes would try to do an additional read with offset equal to filesize. This resulted in an invalid attribute error. This is fixed by giving the right answer instead of EINVAL. Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 591a97cf6b65..65d7cde4c5d1 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c @@ -258,6 +258,9 @@ static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj, struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); int retval; + if (off >= real_size) + return 0; + if (off != 0 || count != real_size) return -EINVAL;