Skip to content

Commit

Permalink
HID: fix parsing of local delimiter with size 0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Kosina committed Jan 5, 2010
1 parent cf2f765 commit 722612c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
__u32 data;
unsigned n;

if (item->size == 0) {
/* Local delimiter could have value 0, which allows size to be 0 */
if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
dbg_hid("item data expected for local item\n");
return -1;
}
Expand Down

0 comments on commit 722612c

Please sign in to comment.