linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] HID: roccat: Fix an error message when reading more data from bin attributes
@ 2011-01-06  8:00 Stefan Achatz
  0 siblings, 0 replies; only message in thread
From: Stefan Achatz @ 2011-01-06  8:00 UTC (permalink / raw)
  To: Randy Dunlap, Jiri Kosina, Stefan Achatz, linux-doc, linux-kernel,
	linux-inp

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 <erazor_de@users.sourceforge.net>
---
 drivers/hid/hid-roccat-koneplus.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c
index 1608c8d..2df87bb 100644
--- a/drivers/hid/hid-roccat-koneplus.c
+++ b/drivers/hid/hid-roccat-koneplus.c
@@ -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;
 
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-06  8:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06  8:00 [PATCH 2/2] HID: roccat: Fix an error message when reading more data from bin attributes Stefan Achatz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).