hid_parse failure

Started by srinivas pandruvada on May 10, 2012 · 2 messages from 2 authors · Last reply May 14, 2012

Subsystems (2)

Maintainers (3)

STALE5317d

open the first message on its own page

Message details and related content
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 <redacted>
---
 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 4da66b4..b7d758c 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;
 	}
 
-- 
1.7.7.6
Message details and related content
On Thu, 10 May 2012, srinivas pandruvada wrote:
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 <redacted>
I have made the subject line a little bit more verbose, added a bit of 
explanatory comment before the condition, and applied.

Thanks,

-- 
Jiri Kosina
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help