aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-monterey.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-08-21 10:57:48 -0400
committerJiri Kosina <jkosina@suse.cz>2014-08-21 11:43:28 -0400
commit4ab25786c87eb20857bbb715c3ae34ec8fd6a214 (patch)
treea1f0b37bd3f77e369398df733e76c222f0a8f86d /drivers/hid/hid-monterey.c
parentad3e14d7c5268c2e24477c6ef54bbdf88add5d36 (diff)
HID: fix a couple of off-by-ones
There are a few very theoretical off-by-one bugs in report descriptor size checking when performing a pre-parsing fixup. Fix those. Cc: stable@vger.kernel.org Reported-by: Ben Hawkes <hawkes@google.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-monterey.c')
-rw-r--r--drivers/hid/hid-monterey.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-monterey.c b/drivers/hid/hid-monterey.c
index 9e14c00eb1b6..25daf28b26bd 100644
--- a/drivers/hid/hid-monterey.c
+++ b/drivers/hid/hid-monterey.c
@@ -24,7 +24,7 @@
24static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, 24static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
25 unsigned int *rsize) 25 unsigned int *rsize)
26{ 26{
27 if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { 27 if (*rsize >= 31 && rdesc[29] == 0x05 && rdesc[30] == 0x09) {
28 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n"); 28 hid_info(hdev, "fixing up button/consumer in HID report descriptor\n");
29 rdesc[30] = 0x0c; 29 rdesc[30] = 0x0c;
30 } 30 }