From: Dan Carpenter <dan.carpenter@oracle.com>
To: Cosmin Tanislav <cosmin.tanislav@analog.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config()
Date: Wed, 15 Dec 2021 14:50:53 +0300 [thread overview]
Message-ID: <20211215115053.GE14552@kili> (raw)
The > needs to be >= to prevent accessing one element beyond the end of
the st->channel_configs[] array.
Fixes: fea251b6a5db ("iio: addac: add AD74413R driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Obligatory grumble: When you merge a new driver please use a patch
prefix based on what the driver will use.
Bad: [SUBJECT] subsystem: add new driver for XYZ123
Good: [SUBJECT] subsystem/xyz123: add new driver for XYZ123
Same rule for adding subdirectories. That way no one (me) has to guess.
drivers/iio/addac/ad74413r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index cbd9aa9b399a..289d254943e1 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -1150,7 +1150,7 @@ static int ad74413r_parse_channel_config(struct iio_dev *indio_dev,
return ret;
}
- if (index > AD74413R_CHANNEL_MAX) {
+ if (index >= AD74413R_CHANNEL_MAX) {
dev_err(st->dev, "Channel index %u is too large\n", index);
return -EINVAL;
}
--
2.20.1
next reply other threads:[~2021-12-15 11:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 11:50 Dan Carpenter [this message]
2021-12-16 10:50 ` [PATCH] iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config() Tanislav, Cosmin
2021-12-16 12:30 ` 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=20211215115053.GE14552@kili \
--to=dan.carpenter@oracle.com \
--cc=Michael.Hennerich@analog.com \
--cc=cosmin.tanislav@analog.com \
--cc=jic23@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--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