From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Marek Vasut <marex@denx.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Alexandre Belloni <alexandre.belloni@free-electrons.com>
Subject: [PATCH 2/3] iio: mxs-lradc: fix invalid channel number detection
Date: Mon, 13 Jan 2014 17:02:02 +0100 [thread overview]
Message-ID: <1389628923-8689-3-git-send-email-alexandre.belloni@free-electrons.com> (raw)
In-Reply-To: <1389628923-8689-1-git-send-email-alexandre.belloni@free-electrons.com>
16 would be accepted as a channel number but it is invalid. It doesn't really
have any effect as mxs_lradc_read_raw is called from a "controlled" environment
so it it only gets values going from 0 to 15.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/staging/iio/adc/mxs-lradc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index aa86849daeba..2289dc1bd928 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -898,7 +898,7 @@ static int mxs_lradc_read_raw(struct iio_dev *iio_dev,
struct mxs_lradc *lradc = iio_priv(iio_dev);
/* Check for invalid channel */
- if (chan->channel > LRADC_MAX_TOTAL_CHANS)
+ if (chan->channel >= LRADC_MAX_TOTAL_CHANS)
return -EINVAL;
switch (m) {
--
1.8.3.2
next prev parent reply other threads:[~2014-01-13 16:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-13 16:02 [PATCH 0/3] iio: mxs-lradc fixes Alexandre Belloni
2014-01-13 16:02 ` [PATCH 1/3] iio: mxs-lradc: fix buffer overflow Alexandre Belloni
2014-01-18 11:31 ` Jonathan Cameron
2014-01-13 16:02 ` Alexandre Belloni [this message]
2014-01-13 20:25 ` [PATCH 2/3] iio: mxs-lradc: fix invalid channel number detection Marek Vasut
2014-01-13 23:43 ` Alexandre Belloni
2014-01-14 18:52 ` Jonathan Cameron
2014-01-13 16:02 ` [PATCH 3/3] iio: mxs-lradc: remove useless scale_available files Alexandre Belloni
2014-01-18 11:32 ` 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=1389628923-8689-3-git-send-email-alexandre.belloni@free-electrons.com \
--to=alexandre.belloni@free-electrons.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
/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
all inboxes | Powered by JetHome®