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: <20181208154432.34e248bd@archlinux>
Date:   Sat, 8 Dec 2018 15:44:32 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Mircea Caprioru <mircea.caprioru@...log.com>
Cc:     <Michael.Hennerich@...log.com>, <knaack.h@....de>,
        <lars@...afoo.de>, <pmeerw@...erw.net>,
        <gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>,
        <linux-iio@...r.kernel.org>, <devel@...verdev.osuosl.org>
Subject: Re: [PATCH] iio: dac: ad5686: fix bit shift read register

On Thu, 6 Dec 2018 15:53:15 +0200
Mircea Caprioru <mircea.caprioru@...log.com> wrote:

> This patch solves the register readback issue with the bit shift. When the
> dac resolution was lower than the register size (ex. 12 bits out of 16
> bits) the readback value was not shifted with the difference in bits and
> the value was higher. Also a mask is applied on the read value in order to
> get the value relative to the actual bit size.
> 
> Fixes: 0357e488b8 ("iio:dac:ad5686: Refactor the driver")
> Signed-off-by: Mircea Caprioru <mircea.caprioru@...log.com>
This seems obvious, but a little strange we've not noticed it
before.    Ah well.  Given the time in the cycle I'm going to
take it for the next merge window rather than rushing it it.

Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/dac/ad5686.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index 54ff76b93366..a332b93ca2c4 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
> @@ -128,7 +128,8 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
>  		mutex_unlock(&indio_dev->mlock);
>  		if (ret < 0)
>  			return ret;
> -		*val = ret;
> +		*val = (ret >> chan->scan_type.shift) &
> +			GENMASK(chan->scan_type.realbits - 1, 0);
>  		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_SCALE:
>  		*val = st->vref_mv;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ