diff options
author | srinivas pandruvada <srinivas.pandruvada@intel.com> | 2012-05-10 16:45:31 -0700 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-05-14 14:57:26 +0200 |
commit | 0cd516c246759bb57b69d836b625d8f8c566e8ca (patch) | |
tree | 5d75d5d8edbe123cd98414143981d0a523527938 /drivers/hid | |
parent | d6d7c873529abd622897cad5e36f1fd7d82f5110 (diff) |
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: srinivas pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 0cddcaa3fe7..0bfbc4813ad 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -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; } |