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]
Message-ID: <20210114184330.ka6o5cxhe5ikyeoa@earth.universe>
Date:   Thu, 14 Jan 2021 19:43:30 +0100
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Ricardo Rivera-Matos <r-rivera-matos@...com>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        dan.carpenter@...cle.com
Subject: Re: [PATCH] power: supply: bq256xx: Fix BQ256XX_NUM_WD_VAL and
 bq256xx_watchdog_time[] overrun

Hi,

On Wed, Jan 13, 2021 at 04:53:52PM -0600, Ricardo Rivera-Matos wrote:
> Corrects BQ256XX_NUM_WD_VAL from value of "8" to "4" and fixes the issue when 'i'
> is equal to array size then array index over runs the array
> 
> Fixes: 32e4978bb92 ("power: supply: bq256xx: Introduce the BQ256XX charger driver")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Ricardo Rivera-Matos <r-rivera-matos@...com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/bq256xx_charger.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c
> index dc74c44618af..8414472083a6 100644
> --- a/drivers/power/supply/bq256xx_charger.c
> +++ b/drivers/power/supply/bq256xx_charger.c
> @@ -135,7 +135,7 @@
>  #define BQ256XX_NTC_FAULT_COLD		(BIT(2) | BIT(0))
>  #define BQ256XX_NTC_FAULT_HOT		(BIT(2) | BIT(1))
>  
> -#define BQ256XX_NUM_WD_VAL	8
> +#define BQ256XX_NUM_WD_VAL	4
>  #define BQ256XX_WATCHDOG_MASK	GENMASK(5, 4)
>  #define BQ256XX_WATCHDOG_MAX	1600000
>  #define BQ256XX_WATCHDOG_DIS	0
> @@ -1508,6 +1508,10 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)
>  	int i;
>  
>  	for (i = 0; i < BQ256XX_NUM_WD_VAL; i++) {
> +		if (bq->watchdog_timer == bq256xx_watchdog_time[i]) {
> +			wd_reg_val = i;
> +			break;
> +		}
>  		if (bq->watchdog_timer > bq256xx_watchdog_time[i] &&
>  		    bq->watchdog_timer < bq256xx_watchdog_time[i + 1])
>  			wd_reg_val = i;
> -- 
> 2.30.0
> 

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