Commit a77d60ae authored by Dan Carpenter's avatar Dan Carpenter Committed by Anton Vorontsov

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAnton Vorontsov <anton.vorontsov@linaro.org>
parent a5af0922
...@@ -279,7 +279,8 @@ static int __devinit gab_probe(struct platform_device *pdev) ...@@ -279,7 +279,8 @@ static int __devinit gab_probe(struct platform_device *pdev)
} }
memcpy(psy->properties, gab_props, sizeof(gab_props)); 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 * getting channel from iio and copying the battery properties
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment