Re: [patch] HID: uclogic: fix limit in uclogic_tablet_enable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > 
> > 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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux