Skip to content

Commit

Permalink
Fix Wstringop-overflow warning on latest ARM SDK (betaflight#13659)
Browse files Browse the repository at this point in the history
Fix Wstringop-overflow warning
  • Loading branch information
haslinghuis authored May 30, 2024
1 parent 1074950 commit 6885deb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/drivers/dma_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6885deb

Please sign in to comment.