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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 4 Sep 2017 16:26:13 +0100
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Dragos Bogdan <dragos.bogdan@...log.com>
CC:     Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        "Hartmut Knaack" <knaack.h@....de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        <linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio:ad7793: Fix the serial interface reset

On Mon, 4 Sep 2017 18:00:48 +0300
Dragos Bogdan <dragos.bogdan@...log.com> wrote:

> The serial interface can be reset by writing 32 consecutive 1s to the device.
> The value of 'ret' is overwritten when ad7793_check_platform_data() is called,
> so it should be initialized to -1 only before doing the spi_write().
> 
> Fixes: commit 2edb769d246e ("iio:ad7793: Add support for the ad7798 and ad7799")
> 
> Signed-off-by: Dragos Bogdan <dragos.bogdan@...log.com>

Hi Dragos,

I'd prefer we introduced a separate variable.  Using ret for this
is what got us into trouble in the first place.

Would you mind respining with that change?

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad7793.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
> index e6706a09e100..8680abf72dd2 100644
> --- a/drivers/iio/adc/ad7793.c
> +++ b/drivers/iio/adc/ad7793.c
> @@ -257,7 +257,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
>  	unsigned int vref_mv)
>  {
>  	struct ad7793_state *st = iio_priv(indio_dev);
> -	int i, ret = -1;
> +	int i, ret;
>  	unsigned long long scale_uv;
>  	u32 id;
>  
> @@ -266,6 +266,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
>  		return ret;
>  
>  	/* reset the serial interface */
> +	ret = -1;
>  	ret = spi_write(st->sd.spi, (u8 *)&ret, sizeof(ret));
>  	if (ret < 0)
>  		goto out;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ