From 722612cd51cf1b574c89dff57cc5dbedf1f645bb Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Tue, 5 Jan 2010 11:45:52 +0100 Subject: 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 Signed-off-by: Jiri Kosina --- drivers/hid/hid-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/hid/hid-core.c') 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) __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; } -- cgit v1.2.3