aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2023-09-28 16:43:42 -0700
committerVinod Koul <[email protected]>2023-10-04 15:12:57 +0530
commit74d885711c2f619e92f41ef308691948cc63f224 (patch)
tree60f8bb2263b54677f6f60a1b2e2b4a9b1b185a16
parent7af1e0aceeb321cbc90fcf6fa0bec8870290377f (diff)
dmaengine: ep93xx_dma: Annotate struct ep93xx_dma_engine with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct ep93xx_dma_engine. [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci Cc: Vinod Koul <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: Tom Rix <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: "Gustavo A. R. Silva" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
-rw-r--r--drivers/dma/ep93xx_dma.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 5c4a448a1254..d6c60635e90d 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -213,7 +213,7 @@ struct ep93xx_dma_engine {
#define INTERRUPT_NEXT_BUFFER 2
size_t num_channels;
- struct ep93xx_dma_chan channels[];
+ struct ep93xx_dma_chan channels[] __counted_by(num_channels);
};
static inline struct device *chan2dev(struct ep93xx_dma_chan *edmac)