Skip to content

Commit 74d8857

Browse files
keesvinodkoul
authored andcommitted
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]>
1 parent 7af1e0a commit 74d8857

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dma/ep93xx_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ struct ep93xx_dma_engine {
213213
#define INTERRUPT_NEXT_BUFFER 2
214214

215215
size_t num_channels;
216-
struct ep93xx_dma_chan channels[];
216+
struct ep93xx_dma_chan channels[] __counted_by(num_channels);
217217
};
218218

219219
static inline struct device *chan2dev(struct ep93xx_dma_chan *edmac)

0 commit comments

Comments
 (0)