From 3d7f7c32e35e1935b252149f319dffcb0dc3f537 Mon Sep 17 00:00:00 2001 From: morris Date: Fri, 9 Jun 2023 11:41:16 +0800 Subject: [PATCH] adc: fix out of bound read when SOC_ADC_PERIPH_NUM==1, the adc_unit should only be assigned with 0 --- components/driver/deprecated/adc_dma_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/driver/deprecated/adc_dma_legacy.c b/components/driver/deprecated/adc_dma_legacy.c index d03bc67e24..7b1f135d20 100644 --- a/components/driver/deprecated/adc_dma_legacy.c +++ b/components/driver/deprecated/adc_dma_legacy.c @@ -104,7 +104,7 @@ static void adc_dma_intr_handler(void *arg); static int8_t adc_digi_get_io_num(adc_unit_t adc_unit, uint8_t adc_channel) { - assert(adc_unit <= SOC_ADC_PERIPH_NUM); + assert(adc_unit < SOC_ADC_PERIPH_NUM); uint8_t adc_n = (adc_unit == ADC_UNIT_1) ? 0 : 1; return adc_channel_io_map[adc_n][adc_channel]; }