Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: sh: rcar-dmac: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper

Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members, instead. So, replace zero-length arrays
declarations in anonymous union with the new DECLARE_FLEX_ARRAY()
helper macro.

This helper allows for flexible-array members in unions.

Link: https://github.com/KSPP/linux/issues/193
Link: https://github.com/KSPP/linux/issues/217
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/YzIdsJqsR3LH2qEK@work
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Gustavo A. R. Silva and committed by
Vinod Koul
45ecf27f d1083fd0

+2 -2
+2 -2
drivers/dma/sh/rcar-dmac.c
··· 103 103 struct list_head node; 104 104 105 105 union { 106 - struct rcar_dmac_desc descs[0]; 107 - struct rcar_dmac_xfer_chunk chunks[0]; 106 + DECLARE_FLEX_ARRAY(struct rcar_dmac_desc, descs); 107 + DECLARE_FLEX_ARRAY(struct rcar_dmac_xfer_chunk, chunks); 108 108 }; 109 109 }; 110 110