Skip to content

Commit c223baf

Browse files
keesvinodkoul
authored andcommitted
dmaengine: fsl-edma: Annotate struct struct fsl_edma_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 struct fsl_edma_engine. Cc: Vinod Koul <[email protected]> Cc: [email protected] Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1] 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 eb15bd5 commit c223baf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dma/fsl-edma-common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ struct fsl_edma_engine {
213213
bool big_endian;
214214
struct edma_regs regs;
215215
u64 chan_masked;
216-
struct fsl_edma_chan chans[];
216+
struct fsl_edma_chan chans[] __counted_by(n_chans);
217217
};
218218

219219
#define edma_read_tcdreg(chan, __name) \

0 commit comments

Comments
 (0)