iio: sx9310: Off by one in sx9310_read_thresh()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 1 Dec 2020 07:03:28 +0000 (10:03 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 14 Jan 2021 20:54:42 +0000 (20:54 +0000)
commita06b63a1200bd40fd20fa695739e479e2b2ae948
tree8ed5196b4328982f36a5776607ecb547cd2d8487
parent7c53f6b671f4aba70ff15e1b05148b10d58c2837
iio: sx9310: Off by one in sx9310_read_thresh()

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>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/X8XqwK0z//8sSWJR@mwanda
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/proximity/sx9310.c