From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/3] iio:ad5064: Fix off by one in DAC value range check
Date: Sat, 02 Mar 2013 16:24:29 +0000 [thread overview]
Message-ID: <513227BD.3050000@kernel.org> (raw)
In-Reply-To: <1362143239-891-2-git-send-email-lars@metafoo.de>
On 03/01/2013 01:07 PM, Lars-Peter Clausen wrote:
> The DAC value range check allows values one larger than the maximum value, which
> effectively results in setting the DAC value to 0. This patch fixes the issue.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
applied to fixes-togreg branch of iio.git
> ---
> drivers/iio/dac/ad5064.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index e19b73f..a491976 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -257,7 +257,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
>
> switch (mask) {
> case IIO_CHAN_INFO_RAW:
> - if (val > (1 << chan->scan_type.realbits) || val < 0)
> + if (val >= (1 << chan->scan_type.realbits) || val < 0)
> return -EINVAL;
>
> mutex_lock(&indio_dev->mlock);
>
next prev parent reply other threads:[~2013-03-02 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 13:07 [PATCH 1/3] iio:ad5064: Fix address of the second channel for ad5065/ad5045/ad5025 Lars-Peter Clausen
2013-03-01 13:07 ` [PATCH 2/3] iio:ad5064: Fix off by one in DAC value range check Lars-Peter Clausen
2013-03-02 16:24 ` Jonathan Cameron [this message]
2013-03-01 13:07 ` [PATCH 3/3] iio:ad5064: Initialize register cache correctly Lars-Peter Clausen
2013-03-02 16:25 ` Jonathan Cameron
2013-03-02 16:23 ` [PATCH 1/3] iio:ad5064: Fix address of the second channel for ad5065/ad5045/ad5025 Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=513227BD.3050000@kernel.org \
--to=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox