public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Colin King <colin.king@canonical.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Jonathan Cameron <jic23@kernel.org>,
	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: dac: fix off-by-one comparison and out-of-bounds write
Date: Thu, 2 Jun 2016 12:53:44 +0200	[thread overview]
Message-ID: <57501038.1070207@analog.com> (raw)
In-Reply-To: <1464861990-9155-1-git-send-email-colin.king@canonical.com>

On 06/02/2016 12:06 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The check on reg is off-by-one, it should be >= rather than >. Fix
> this to stop an out-of-bounds write to st->channel_modes[reg].
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>   drivers/iio/dac/ad5592r-base.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
> index 948f600..69bde59 100644
> --- a/drivers/iio/dac/ad5592r-base.c
> +++ b/drivers/iio/dac/ad5592r-base.c
> @@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st)
>
>   	device_for_each_child_node(st->dev, child) {
>   		ret = fwnode_property_read_u32(child, "reg", &reg);
> -		if (ret || reg > ARRAY_SIZE(st->channel_modes))
> +		if (ret || reg >= ARRAY_SIZE(st->channel_modes))
>   			continue;
>
>   		ret = fwnode_property_read_u32(child, "adi,mode", &tmp);
>


-- 
Greetings,
Michael

--
Analog Devices GmbH      Otl-Aicher Strasse 60-64      80807 München
Sitz der Gesellschaft München, Registergericht München HRB 40368,
Geschäftsführer: Peter Kolberg, Ali Raza Husain, Eileen Wynne

  reply	other threads:[~2016-06-02 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02 10:06 [PATCH] iio: dac: fix off-by-one comparison and out-of-bounds write Colin King
2016-06-02 10:53 ` Michael Hennerich [this message]
2016-06-03 12:00   ` 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=57501038.1070207@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=colin.king@canonical.com \
    --cc=jic23@kernel.org \
    --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