Re: Potential uninitialized variables in power: supply: rt5033_battery:

From: Sebastian Reichel
Date: Sun Oct 13 2019 - 23:12:44 EST


Hi,

On Thu, Oct 03, 2019 at 09:21:44PM -0700, Yizhuo Zhai wrote:
> drivers/power/supply/rt5033_battery.c:
>
> In function rt5033_battery_get_present(), variable "val" could be
> uninitialized if regmap_read() returns -EINVAL. However, "val" is
> used to decide the return value, which is potentially unsafe.
>
> Also, we cannot simply return -EINVAL in rt5033_battery_get_present()
> because it's not an acceptable return value.
>
> Thanks for your time to check this case.

Should be fine to just return false when regmap_read() fails.
Will you prepare a patch for that?

Thanks,

-- Sebastian

Attachment: signature.asc
Description: PGP signature