From: Stefan Achatz <erazor_de@users.sourceforge.net> To: Randy Dunlap <rdunlap@xenotime.net>, Jiri Kosina <jkosina@suse.cz>, Stefan Achatz <erazor_de@users.sourceforge.net>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: [PATCH 2/2] HID: roccat: Fix an error message when reading more data from bin attributes Date: Thu, 06 Jan 2011 09:00:41 +0100 [thread overview] Message-ID: <1294300841.5622.59.camel@neuromancer> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Achatz <erazor_de@users.sourceforge.net> To: Randy Dunlap <rdunlap@xenotime.net>, Jiri Kosina <jkosina@suse.cz>, Stefan Achatz <erazor_de@users.sourceforge.net>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-inp Subject: [PATCH 2/2] HID: roccat: Fix an error message when reading more data from bin attributes Date: Thu, 06 Jan 2011 09:00:41 +0100 [thread overview] Message-ID: <1294300841.5622.59.camel@neuromancer> (raw) 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
next reply other threads:[~2011-01-06 8:00 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-06 8:00 Stefan Achatz [this message] 2011-01-06 8:00 ` [PATCH 2/2] HID: roccat: Fix an error message when reading more data from bin attributes Stefan Achatz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1294300841.5622.59.camel@neuromancer \ --to=erazor_de@users.sourceforge.net \ --cc=jkosina@suse.cz \ --cc=linux-doc@vger.kernel.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=rdunlap@xenotime.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.