Dan Carpenter 279c3a2a5e iio: adc: palmas: fix off by one bugs
Valid values for "adc_chan" are zero to (PALMAS_ADC_CH_MAX - 1).
Smatch detects some buffer overflows caused by this:
drivers/iio/adc/palmas_gpadc.c:721 palmas_gpadc_read_event_value() error: buffer overflow 'adc->thresholds' 16 <= 16
drivers/iio/adc/palmas_gpadc.c:758 palmas_gpadc_write_event_value() error: buffer overflow 'adc->thresholds' 16 <= 16

The effect of this bug in other functions is more complicated but
obviously we should fix all of them.

Fixes: a99544c6c883 ("iio: adc: palmas: add support for iio threshold events")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/14fee94a-7db7-4371-b7d6-e94d86b9561e@kili.mountain
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-05-13 17:54:57 +01:00
..
2023-02-18 17:06:09 +00:00
2022-07-16 18:50:24 +01:00
2022-12-30 18:05:16 +00:00
2023-03-12 14:56:02 +00:00
2023-03-12 14:56:02 +00:00
2022-09-05 18:08:34 +01:00
2022-07-18 18:29:29 +01:00
2023-03-28 13:30:55 +02:00
2022-08-15 22:29:57 +01:00
2023-02-06 08:35:30 +01:00