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, 31 Jul 2021 14:47:32 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Colin King <colin.king@...onical.com>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Lee Jones <lee.jones@...aro.org>,
        Laxman Dewangan <ldewangan@...dia.com>,
        Pradeep Goudagunta <pgoudagunta@...dia.com>,
        Marek Belisko <marek@...delico.com>, linux-iio@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: Fix incorrect exit of for-loop

On Fri, 30 Jul 2021 08:16:51 +0100
Colin King <colin.king@...onical.com> wrote:

> From: Colin Ian King <colin.king@...onical.com>
> 
> Currently the for-loop that scans for the optimial adc_period iterates
> through all the possible adc_period levels because the exit logic in
> the loop is inverted. I believe the comparison should be swapped and
> the continue replaced with a break to exit the loop at the correct
> point.
> 
> Addresses-Coverity: ("Continue has no effect")
> Fixes: e08e19c331fb ("iio:adc: add iio driver for Palmas (twl6035/7) gpadc")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
ouch.

Applied to the fixes togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/palmas_gpadc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
> index 6ef09609be9f..f9c8385c72d3 100644
> --- a/drivers/iio/adc/palmas_gpadc.c
> +++ b/drivers/iio/adc/palmas_gpadc.c
> @@ -664,8 +664,8 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc)
>  
>  	adc_period = adc->auto_conversion_period;
>  	for (i = 0; i < 16; ++i) {
> -		if (((1000 * (1 << i)) / 32) < adc_period)
> -			continue;
> +		if (((1000 * (1 << i)) / 32) >= adc_period)
> +			break;
>  	}
>  	if (i > 0)
>  		i--;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ