* [patch] HID: uclogic: fix limit in uclogic_tablet_enable()
@ 2015-07-29 10:16 Dan Carpenter
2015-07-29 10:27 ` Nikolai Kondrashov
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-07-29 10:16 UTC (permalink / raw)
To: Jiri Kosina, Nikolai Kondrashov; +Cc: linux-input, kernel-janitors
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] HID: uclogic: fix limit in uclogic_tablet_enable()
2015-07-29 10:16 [patch] HID: uclogic: fix limit in uclogic_tablet_enable() Dan Carpenter
@ 2015-07-29 10:27 ` Nikolai Kondrashov
2015-07-29 12:07 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Nikolai Kondrashov @ 2015-07-29 10:27 UTC (permalink / raw)
To: Dan Carpenter, Jiri Kosina; +Cc: linux-input, kernel-janitors
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] HID: uclogic: fix limit in uclogic_tablet_enable()
2015-07-29 10:27 ` Nikolai Kondrashov
@ 2015-07-29 12:07 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2015-07-29 12:07 UTC (permalink / raw)
To: Nikolai Kondrashov; +Cc: Dan Carpenter, linux-input, kernel-janitors
On Wed, 29 Jul 2015, Nikolai Kondrashov wrote:
> 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!
Good catch Dan, thanks. Applied to for-4.2/upstream-fixes.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-29 12:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 10:16 [patch] HID: uclogic: fix limit in uclogic_tablet_enable() Dan Carpenter
2015-07-29 10:27 ` Nikolai Kondrashov
2015-07-29 12:07 ` Jiri Kosina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).