From: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
To: jkosina@suse.cz, linux-input@vger.kernel.org
Subject: Re: [PATCH] hid_parse failure
Date: Tue, 08 May 2012 19:06:12 -0700 [thread overview]
Message-ID: <4FA9D114.2010208@intel.com> (raw)
Any comments on my patch for hid parsing failure (submitted on May 1st)?
Thanks,
Srinivas
When logical maximum is 0xffffffff, the parser fails even if
logical minimum is equal to or greater than 0.
By HID specification, if both the Logical Minimum and Logical
Maximum extents are defined as positive values (0 or greater)
then the report field can be assumed to be an unsigned value.
Otherwise, all integer values are signed values represented
in 2’s complement format.
---
drivers/hid/hid-core.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c757f10..b616f4b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -225,8 +225,16 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
return -1;
}
- if (parser->global.logical_maximum< parser->global.logical_minimum) {
- dbg_hid("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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2012-05-09 2:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 2:06 Srinivas Pandruvada [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-05-10 23:45 [PATCH] hid_parse failure srinivas pandruvada
2012-05-14 13:04 ` Jiri Kosina
2012-05-01 16:07 srinivas pandruvada
2012-05-10 10:21 ` Jiri Kosina
2012-05-10 14:04 ` Pandruvada, Srinivas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FA9D114.2010208@intel.com \
--to=srinivas.pandruvada@intel.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.