lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 19 Oct 2019 12:25:14 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Yizhuo <yzhai003@....edu>
Cc:     zhiyunq@...ucr.edu, csong@...ucr.edu, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: supply: rt5033_battery: Fix the usage of
 potential uninitialized variable

Hi,

On Tue, Oct 15, 2019 at 09:57:37AM -0700, Yizhuo wrote:
> 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.
> 
> Signed-off-by: Yizhuo <yzhai003@....edu>
> ---

The patch looks good, but your name in author and Signed-off-by line
look incomplete (only one name). Please resend with full name as
patch author and Signed-off-by.

Thanks,

-- Sebastian

>  drivers/power/supply/rt5033_battery.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c
> index d8667a9fc49b..6a617531698c 100644
> --- a/drivers/power/supply/rt5033_battery.c
> +++ b/drivers/power/supply/rt5033_battery.c
> @@ -26,8 +26,14 @@ static int rt5033_battery_get_present(struct i2c_client *client)
>  {
>  	struct rt5033_battery *battery = i2c_get_clientdata(client);
>  	u32 val;
> +	int ret;
>  
> -	regmap_read(battery->regmap, RT5033_FUEL_REG_CONFIG_L, &val);
> +	ret = regmap_read(battery->regmap, RT5033_FUEL_REG_CONFIG_L, &val);
> +	if (ret) {
> +		dev_err(&client->dev,
> +			"Failed to read RT5033_FUEL_REG_CONFIG_L.\n");
> +		return false;
> +	}
>  
>  	return (val & RT5033_FUEL_BAT_PRESENT) ? true : false;
>  }
> -- 
> 2.17.1
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ