From: Jonathan Cameron <jic23@kernel.org>
To: Colin King <colin.king@canonical.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: ad5755: fix off-by-one on devnr limit check
Date: Sun, 21 Aug 2016 20:30:35 +0100 [thread overview]
Message-ID: <1efdfc25-b13d-c383-2346-75b414b32081@kernel.org> (raw)
In-Reply-To: <1469486401-17839-1-git-send-email-colin.king@canonical.com>
On 25/07/16 23:40, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The comparison for devnr limits is off-by-one, the current check
> allows 0 to AD5755_NUM_CHANNELS and the limit should be in fact
> 0 to AD5755_NUM_CHANNELS - 1. This can lead to an out of bounds
> write to pdata->dac[devnr]. Fix this by replacing > with >= on the
> comparison.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Lars?
Looks correct to me.
I'd also like a fixes tag for this if possible. Guessing it
might well be the original driver introduction but best to be
sure ;)
Jonathan
> ---
> drivers/iio/dac/ad5755.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index 0fde593..5f79682 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -655,7 +655,7 @@ static struct ad5755_platform_data *ad5755_parse_dt(struct device *dev)
>
> devnr = 0;
> for_each_child_of_node(np, pp) {
> - if (devnr > AD5755_NUM_CHANNELS) {
> + if (devnr >= AD5755_NUM_CHANNELS) {
> dev_err(dev,
> "There is to many channels defined in DT\n");
> goto error_out;
>
next prev parent reply other threads:[~2016-08-21 19:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 22:40 Colin King
2016-08-21 19:30 ` Jonathan Cameron [this message]
2016-08-21 20:07 ` Lars-Peter Clausen
2016-08-29 15:16 ` 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=1efdfc25-b13d-c383-2346-75b414b32081@kernel.org \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=colin.king@canonical.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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®