提交 fd82be6c 编写于 作者: S Stefan Achatz 提交者: Jiri Kosina

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: NStefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 e68cc603
...@@ -258,6 +258,9 @@ static ssize_t koneplus_sysfs_read(struct file *fp, struct kobject *kobj, ...@@ -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)); struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
int retval; int retval;
if (off >= real_size)
return 0;
if (off != 0 || count != real_size) if (off != 0 || count != real_size)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册