linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Stephen Boyd <swboyd@chromium.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Daniel Campello <campello@chromium.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Douglas Anderson <dianders@chromium.org>,
	linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
Date: Sun, 13 Dec 2020 13:23:03 +0000	[thread overview]
Message-ID: <20201213132303.4b362987@archlinux> (raw)
In-Reply-To: <X8XqwK0z//8sSWJR@mwanda>

On Tue, 1 Dec 2020 10:03:28 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> This > should be >= to prevent reading one element beyond the end of
> the sx9310_pthresh_codes[] array.
> 
> Fixes: ad2b473e2ba3 ("iio: sx9310: Support setting proximity thresholds")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to the fixes-togreg branch of iio.git which won't go anywhere now
until after rc1 (and is based on the stuff queued up for the merge window)

thanks,

Jonathan

> ---
>  drivers/iio/proximity/sx9310.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index a2f820997afc..62eacb22e9bc 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -601,7 +601,7 @@ static int sx9310_read_thresh(struct sx9310_data *data,
>  		return ret;
>  
>  	regval = FIELD_GET(SX9310_REG_PROX_CTRL8_9_PTHRESH_MASK, regval);
> -	if (regval > ARRAY_SIZE(sx9310_pthresh_codes))
> +	if (regval >= ARRAY_SIZE(sx9310_pthresh_codes))
>  		return -EINVAL;
>  
>  	*val = sx9310_pthresh_codes[regval];


      parent reply	other threads:[~2020-12-13 13:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  7:03 [PATCH] iio: sx9310: Off by one in sx9310_read_thresh() Dan Carpenter
2020-12-01 15:43 ` Doug Anderson
2020-12-02 19:32 ` Stephen Boyd
2020-12-13 13:23 ` Jonathan Cameron [this message]

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=20201213132303.4b362987@archlinux \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=campello@chromium.org \
    --cc=dan.carpenter@oracle.com \
    --cc=dianders@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).