[PATCH 01/16] iio: frequency: ad9523: fix out of bounds access of vco_out_map
From: Nuno Sá
Date: Mon Nov 30 2026 - 12:37:38 EST
vco_out_map[] only has room for the first 10 channels, which are the
ones that can select their clock source. However, the frequency read
and write paths index it with any channel number, so accessing the
frequency of channels 10 to 13 reads past the end of the array.
Size the array for all channels. The extra entries are never written
and stay at 0 (AD9523_VCO1), which is the only clock source channels 10
to 13 can use.
Fixes: cd1678f96329 ("iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator")
Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
---
drivers/iio/frequency/ad9523.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 1e393f40a8c8..b0016317a7ea 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -237,7 +237,6 @@
#define AD9523_EEPROM_CTRL2_REG2EEPROM (1 << 0)
#define AD9523_NUM_CHAN 14
-#define AD9523_NUM_CHAN_ALT_CLK_SRC 10
/* Helpers to avoid excess line breaks */
#define AD_IFE(_pde, _a, _b) ((pdata->_pde) ? _a : _b)
@@ -274,7 +273,7 @@ struct ad9523_state {
unsigned long vcxo_freq;
unsigned long vco_freq;
unsigned long vco_out_freq[AD9523_NUM_CLK_SRC];
- unsigned char vco_out_map[AD9523_NUM_CHAN_ALT_CLK_SRC];
+ unsigned char vco_out_map[AD9523_NUM_CHAN];
/*
* Lock for accessing device registers. Some operations require
--
2.56.0