Commit 0cd516c2 authored by srinivas pandruvada's avatar srinivas pandruvada Committed by Jiri Kosina

HID: handle logical min/max signedness properly in parser

When logical maximum is 0xffffffff, the parser fails even if
logical minimum is more than 0.

By HID specification this is a valid combination.
Signed-off-by: default avatarsrinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent d6d7c873
......@@ -230,9 +230,15 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
return -1;
}
if (parser->global.logical_maximum < parser->global.logical_minimum) {
hid_err(parser->device, "logical range invalid %d %d\n",
parser->global.logical_minimum, parser->global.logical_maximum);
if ((parser->global.logical_minimum < 0 &&
parser->global.logical_maximum <
parser->global.logical_minimum) ||
(parser->global.logical_minimum >= 0 &&
(__u32)parser->global.logical_maximum <
(__u32)parser->global.logical_minimum)) {
dbg_hid("logical range invalid 0x%x 0x%x\n",
parser->global.logical_minimum,
parser->global.logical_maximum);
return -1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment