aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-01-05 05:45:52 -0500
committerJiri Kosina <jkosina@suse.cz>2010-01-05 05:45:52 -0500
commit722612cd51cf1b574c89dff57cc5dbedf1f645bb (patch)
tree4e72c3af6430ed32048d158239ad714d750adf7f /drivers/hid
parentcf2f765f1896064e34c6f0f2ef896ff058dd5c06 (diff)
HID: fix parsing of local delimiter with size 0
Acording to HID standard 1.11, value 0 allows for size being 0. Local delimiter tag has has 0 one of the possible values. Therefore we need to handle this case properly, to be fully compliant with the specification. Reported-by: Marcin Tolysz <tolysz@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6462c923805f..a4b496c68259 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -387,7 +387,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
387 __u32 data; 387 __u32 data;
388 unsigned n; 388 unsigned n;
389 389
390 if (item->size == 0) { 390 /* Local delimiter could have value 0, which allows size to be 0 */
391 if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
391 dbg_hid("item data expected for local item\n"); 392 dbg_hid("item data expected for local item\n");
392 return -1; 393 return -1;
393 } 394 }