mirror of
https://github.com/torvalds/linux.git
synced 2024-11-02 02:01:29 +00:00
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 <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This commit is contained in:
parent
a5af092245
commit
a77d60aec7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user