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:   Sun, 20 Oct 2019 23:14:43 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Rhyland Klein <rklein@...dia.com>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] power: supply: sbs-battery: Fix a signedness bug in
 sbs_get_battery_capacity()

Hi,

On Wed, Sep 25, 2019 at 02:01:28PM +0300, Dan Carpenter wrote:
> The "mode" variable is an enum and in this context GCC treats it as an
> unsigned int so the error handling is never triggered.
> 
> Fixes: 51d075660457 ("bq20z75: Add support for charge properties")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index f8d74e9f7931..62110af1abcf 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -555,7 +555,7 @@ static int sbs_get_battery_capacity(struct i2c_client *client,
>  		mode = BATTERY_MODE_AMPS;
>  
>  	mode = sbs_set_battery_mode(client, mode);
> -	if (mode < 0)
> +	if ((int)mode < 0)
>  		return mode;
>  
>  	ret = sbs_read_word_data(client, sbs_data[reg_offset].addr);
> -- 
> 2.20.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