From: Dan Carpenter Date: Sat, 29 Sep 2012 07:13:46 +0000 (+0300) Subject: generic-adc-battery: Pointer math issue in gab_probe() X-Git-Tag: upstream/snapshot3+hdmi~6007^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a77d60aec70183faa68b7df4a3fa89fbaf592cf5;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git generic-adc-battery: Pointer math issue in gab_probe() 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. Signed-off-by: Dan Carpenter Signed-off-by: Anton Vorontsov --- diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c index 4a00ef7..ecbf672 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