2012-11-05 12:34:39

by anish singh

[permalink] [raw]
Subject: Re: [patch] power: battery: pointer math issue in gab_probe()

Hello Dan,

Is this patch of yours picked up by anyone?
On Sun, 2012-09-30 at 09:38 +0530, anish kumar wrote:
> On Sat, 2012-09-29 at 10:13 +0300, Dan Carpenter wrote:
> > psy->properties is an enum (32 bit type) so adding sizeof() puts us
> > four times further along than we intended. It should be cast to a char
> > pointer before doing the math.
> You really read this driver to find out this one.
> Good one.
> >
> > Signed-off-by: Dan Carpenter <[email protected]>
> > ---
> > Casting to void * would also work on GCC, at least.
> >
> > diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c
> > index 9bdf444..776f118 100644
> > --- a/drivers/power/generic-adc-battery.c
> > +++ b/drivers/power/generic-adc-battery.c
> > @@ -279,7 +279,8 @@ static int __devinit gab_probe(struct platform_device *pdev)
> > }
> >
> > memcpy(psy->properties, gab_props, sizeof(gab_props));
> > - properties = psy->properties + sizeof(gab_props);
> > + properties = (enum power_supply_property *)
> > + ((char *)psy->properties + sizeof(gab_props));
> >
> > /*
> > * getting channel from iio and copying the battery properties
>


2012-11-05 13:10:04

by Dan Carpenter

[permalink] [raw]
Subject: Re: [patch] power: battery: pointer math issue in gab_probe()

On Mon, Nov 05, 2012 at 09:34:21PM +0900, anish kumar wrote:
> Hello Dan,
>
> Is this patch of yours picked up by anyone?

David this should go through you?

regards,
dan carpenter

2012-11-05 18:40:14

by Anton Vorontsov

[permalink] [raw]
Subject: Re: [patch] power: battery: pointer math issue in gab_probe()

On Mon, Nov 05, 2012 at 04:09:45PM +0300, Dan Carpenter wrote:
> On Mon, Nov 05, 2012 at 09:34:21PM +0900, anish kumar wrote:
> > Hello Dan,
> >
> > Is this patch of yours picked up by anyone?
>
> David this should go through you?

I'll merge it soon. Sorry for the delay, quite busy lately. :-/

Thanks!
Anton.