]> err.no Git - linux-2.6/commitdiff
Input: hiddev - fix off-by-one for num_values in uref_multi requests
authorBen Collins <bcollins@ubuntu.com>
Tue, 31 Jan 2006 06:31:13 +0000 (01:31 -0500)
committerDmitry Torokhov <dtor_core@ameritech.net>
Tue, 31 Jan 2006 06:31:13 +0000 (01:31 -0500)
Found this when working with a HAPP UGCI device. It has a usage with 7
indexes. I could read them all one at a time, but using a multiref it
would only allow me to read the first 6. The patch below fixed it.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/usb/input/hiddev.c

index 4dff8473553dd9fc8eba3ebe33378741c8bc7898..3f7274906c1327b2364d8c74e056f1cbe157d502 100644 (file)
@@ -632,7 +632,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
 
                        else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
                                 (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
-                                 uref->usage_index + uref_multi->num_values >= field->report_count))
+                                 uref->usage_index + uref_multi->num_values > field->report_count))
                                goto inval;
                        }