From 6885deb89b696392437d8e1a861295bd57b63bfe Mon Sep 17 00:00:00 2001 From: Mark Haslinghuis Date: Fri, 31 May 2024 01:24:04 +0200 Subject: [PATCH] Fix Wstringop-overflow warning on latest ARM SDK (#13659) Fix Wstringop-overflow warning --- src/main/drivers/dma_common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/drivers/dma_common.c b/src/main/drivers/dma_common.c index 47338bc77c3..d1f880170c1 100644 --- a/src/main/drivers/dma_common.c +++ b/src/main/drivers/dma_common.c @@ -33,6 +33,12 @@ dmaIdentifier_e dmaAllocate(dmaIdentifier_e identifier, resourceOwner_e owner, u } const int index = DMA_IDENTIFIER_TO_INDEX(identifier); + + // Prevent Wstringop-overflow warning + if (index < 0 || index >= DMA_LAST_HANDLER) { + return DMA_NONE; + } + dmaDescriptors[index].owner.owner = owner; dmaDescriptors[index].owner.resourceIndex = resourceIndex;