Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: mp2629: fix potential array out of bound access

Add sentinel at end of maps to avoid potential array out of
bound access in iio core.

Fixes: 7abd9fb64682 ("iio: adc: mp2629: Add support for mp2629 ADC driver")
Signed-off-by: Saravanan Sekar <sravanhome@gmail.com>
Link: https://lore.kernel.org/r/20221029093000.45451-4-sravanhome@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Saravanan Sekar and committed by
Jonathan Cameron
ca1547ab 1eb20332

+2 -1
+2 -1
drivers/iio/adc/mp2629_adc.c
··· 57 57 MP2629_MAP(SYSTEM_VOLT, "system-volt"), 58 58 MP2629_MAP(INPUT_VOLT, "input-volt"), 59 59 MP2629_MAP(BATT_CURRENT, "batt-current"), 60 - MP2629_MAP(INPUT_CURRENT, "input-current") 60 + MP2629_MAP(INPUT_CURRENT, "input-current"), 61 + { } 61 62 }; 62 63 63 64 static int mp2629_read_raw(struct iio_dev *indio_dev,