iio: light: noa1305: Fix up integration time look up
authorMarek Vasut <marex@denx.de>
Wed, 14 Aug 2024 19:19:09 +0000 (21:19 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 17 Aug 2024 14:37:37 +0000 (15:37 +0100)
commit076c4d18de4e93591641d03fb921875c02b30eb3
tree0e092ce152369ac7eec8dc1617871c05d5276e33
parentc524fbca672e07439a4ed5628c93cec10188dc00
iio: light: noa1305: Fix up integration time look up

The current code is always iterating over two fields in the
noa1305_int_time_available array. Fix iteration limit, which
has to be halved to avoid out of bounds access in case the
value that is being looked up is not in the array.

Fixes: 025f23cfebad ("iio: light: noa1305: Make integration time configurable")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://patch.msgid.link/20240814191946.81386-1-marex@denx.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/noa1305.c