Skip to contentSkip to conversation

HID: roccat: Fix an error message when reading more data from bin attributes

PATCH Applied Stefan Achatz 1 participant 1 message Jan 6, 2011

Subsystems (2)
lore
Share & tools
lore

Stefan Achatz

author maintainer
#0 lore raw

PATCH 2/2 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.

---
 drivers/hid/hid-roccat-koneplus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/hid/hid-roccat-koneplus.c +3 -0
index 1608c8d..2df87bb 100644
@@ -256,6 +256,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;
 
Signature · 1 line
1.7.3.4