* [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
@ 2020-12-01 7:03 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-12-01 7:03 UTC (permalink / raw)
To: kernel-janitors
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>
---
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];
--
2.29.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
@ 2020-12-01 7:03 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-12-01 7:03 UTC (permalink / raw)
To: Jonathan Cameron, Stephen Boyd
Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Daniel Campello,
Andy Shevchenko, Douglas Anderson, linux-iio, kernel-janitors
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>
---
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];
--
2.29.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
2020-12-01 7:03 ` Dan Carpenter
@ 2020-12-01 15:43 ` Doug Anderson
-1 siblings, 0 replies; 7+ messages in thread
From: Doug Anderson @ 2020-12-01 15:43 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jonathan Cameron, Stephen Boyd, Lars-Peter Clausen,
Peter Meerwald-Stadler, Daniel Campello, Andy Shevchenko,
linux-iio, kernel-janitors
Hi,
On Mon, Nov 30, 2020 at 11:03 PM 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>
> ---
> drivers/iio/proximity/sx9310.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
@ 2020-12-01 15:43 ` Doug Anderson
0 siblings, 0 replies; 7+ messages in thread
From: Doug Anderson @ 2020-12-01 15:43 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jonathan Cameron, Stephen Boyd, Lars-Peter Clausen,
Peter Meerwald-Stadler, Daniel Campello, Andy Shevchenko,
linux-iio, kernel-janitors
Hi,
On Mon, Nov 30, 2020 at 11:03 PM 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>
> ---
> drivers/iio/proximity/sx9310.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Douglas Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
2020-12-01 7:03 ` Dan Carpenter
@ 2020-12-02 19:32 ` Stephen Boyd
-1 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-12-02 19:32 UTC (permalink / raw)
To: Dan Carpenter, Jonathan Cameron
Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Daniel Campello,
Andy Shevchenko, Douglas Anderson, linux-iio, kernel-janitors
Quoting Dan Carpenter (2020-11-30 23:03:28)
> 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>
> ---
Thanks!
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
@ 2020-12-02 19:32 ` Stephen Boyd
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2020-12-02 19:32 UTC (permalink / raw)
To: Dan Carpenter, Jonathan Cameron
Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Daniel Campello,
Andy Shevchenko, Douglas Anderson, linux-iio, kernel-janitors
Quoting Dan Carpenter (2020-11-30 23:03:28)
> 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>
> ---
Thanks!
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: sx9310: Off by one in sx9310_read_thresh()
2020-12-01 7:03 ` Dan Carpenter
` (2 preceding siblings ...)
(?)
@ 2020-12-13 13:23 ` Jonathan Cameron
-1 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-12-13 13:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: Stephen Boyd, Lars-Peter Clausen, Peter Meerwald-Stadler,
Daniel Campello, Andy Shevchenko, Douglas Anderson, linux-iio,
kernel-janitors
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];
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-12-13 13:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 7:03 [PATCH] iio: sx9310: Off by one in sx9310_read_thresh() Dan Carpenter
2020-12-01 7:03 ` Dan Carpenter
2020-12-01 15:43 ` Doug Anderson
2020-12-01 15:43 ` Doug Anderson
2020-12-02 19:32 ` Stephen Boyd
2020-12-02 19:32 ` Stephen Boyd
2020-12-13 13:23 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.