diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-09-29 10:13:46 +0300 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-11-16 18:36:11 -0800 |
commit | a77d60aec70183faa68b7df4a3fa89fbaf592cf5 (patch) | |
tree | e504b7cfaaf8b51f20c201ded948e1961c9c33d2 | |
parent | a5af092245a33965a4b089e8ba489c2db0f7db16 (diff) | |
download | linux-stable-a77d60aec70183faa68b7df4a3fa89fbaf592cf5.tar.gz linux-stable-a77d60aec70183faa68b7df4a3fa89fbaf592cf5.tar.bz2 linux-stable-a77d60aec70183faa68b7df4a3fa89fbaf592cf5.zip |
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>
-rw-r--r-- | drivers/power/generic-adc-battery.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/power/generic-adc-battery.c b/drivers/power/generic-adc-battery.c index 4a00ef7a8795..ecbf672a35db 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 |