From: Nikolai Kondrashov <spbnick@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Jiri Kosina <jkosina@suse.com>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] HID: uclogic: fix limit in uclogic_tablet_enable()
Date: Wed, 29 Jul 2015 10:27:51 +0000 [thread overview]
Message-ID: <55B8AAA7.6010708@gmail.com> (raw)
In-Reply-To: <20150729101606.GA12100@mwanda>
On 07/29/2015 01:16 PM, Dan Carpenter wrote:
> The limit should be ARRAY_SIZE(params) (5 elements) here instead of
> sizeof(params) (20 bytes).
>
> Fixes: 08177f40bd00 ('HID: uclogic: merge hid-huion driver in hid-uclogic')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
> index 9416731..b905d50 100644
> --- a/drivers/hid/hid-uclogic.c
> +++ b/drivers/hid/hid-uclogic.c
> @@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev)
> for (p = drvdata->rdesc;
> p <= drvdata->rdesc + drvdata->rsize - 4;) {
> if (p[0] = 0xFE && p[1] = 0xED && p[2] = 0x1D &&
> - p[3] < sizeof(params)) {
> + p[3] < ARRAY_SIZE(params)) {
> v = params[p[3]];
> put_unaligned(cpu_to_le32(v), (s32 *)p);
> p += 4;
Argh, that's embarrassing. Thanks, Dan!
Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Nick
WARNING: multiple messages have this Message-ID (diff)
From: Nikolai Kondrashov <spbnick@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>, Jiri Kosina <jkosina@suse.com>
Cc: linux-input@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] HID: uclogic: fix limit in uclogic_tablet_enable()
Date: Wed, 29 Jul 2015 13:27:51 +0300 [thread overview]
Message-ID: <55B8AAA7.6010708@gmail.com> (raw)
In-Reply-To: <20150729101606.GA12100@mwanda>
On 07/29/2015 01:16 PM, Dan Carpenter wrote:
> The limit should be ARRAY_SIZE(params) (5 elements) here instead of
> sizeof(params) (20 bytes).
>
> Fixes: 08177f40bd00 ('HID: uclogic: merge hid-huion driver in hid-uclogic')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
> index 9416731..b905d50 100644
> --- a/drivers/hid/hid-uclogic.c
> +++ b/drivers/hid/hid-uclogic.c
> @@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev)
> for (p = drvdata->rdesc;
> p <= drvdata->rdesc + drvdata->rsize - 4;) {
> if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
> - p[3] < sizeof(params)) {
> + p[3] < ARRAY_SIZE(params)) {
> v = params[p[3]];
> put_unaligned(cpu_to_le32(v), (s32 *)p);
> p += 4;
Argh, that's embarrassing. Thanks, Dan!
Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Nick
next prev parent reply other threads:[~2015-07-29 10:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 10:16 [patch] HID: uclogic: fix limit in uclogic_tablet_enable() Dan Carpenter
2015-07-29 10:16 ` Dan Carpenter
2015-07-29 10:27 ` Nikolai Kondrashov [this message]
2015-07-29 10:27 ` Nikolai Kondrashov
2015-07-29 12:07 ` Jiri Kosina
2015-07-29 12:07 ` Jiri Kosina
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=55B8AAA7.6010708@gmail.com \
--to=spbnick@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=jkosina@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--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.