Skip to content

Commit

Permalink
Input: hiddev - fix off-by-one for num_values in uref_multi requests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Collins authored and Dmitry Torokhov committed Jan 31, 2006
1 parent 97d4ebf commit 6dea934
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/input/hiddev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6dea934

Please sign in to comment.