crypto: Replace zero-length array with flexible-array

There is a regular need in the kernel to provide a way to declare having a
dynamically sized set of trailing elements in a structure. Kernel code should
always use “flexible array members”[1] for these cases. The older style of
one-element or zero-length arrays should no longer be used[2].

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://github.com/KSPP/linux/issues/21

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
This commit is contained in:
Gustavo A. R. Silva 2020-05-28 09:35:11 -05:00
parent d6562f1ca8
commit 6c48764aa4

View file

@ -223,7 +223,7 @@ struct chcr_authenc_ctx {
struct __aead_ctx { struct __aead_ctx {
struct chcr_gcm_ctx gcm[0]; struct chcr_gcm_ctx gcm[0];
struct chcr_authenc_ctx authenc[0]; struct chcr_authenc_ctx authenc[];
}; };
struct chcr_aead_ctx { struct chcr_aead_ctx {
@ -235,7 +235,7 @@ struct chcr_aead_ctx {
u8 nonce[4]; u8 nonce[4];
u16 hmac_ctrl; u16 hmac_ctrl;
u16 mayverify; u16 mayverify;
struct __aead_ctx ctx[0]; struct __aead_ctx ctx[];
}; };
struct hmac_ctx { struct hmac_ctx {
@ -247,7 +247,7 @@ struct hmac_ctx {
struct __crypto_ctx { struct __crypto_ctx {
struct hmac_ctx hmacctx[0]; struct hmac_ctx hmacctx[0];
struct ablk_ctx ablkctx[0]; struct ablk_ctx ablkctx[0];
struct chcr_aead_ctx aeadctx[0]; struct chcr_aead_ctx aeadctx[];
}; };
struct chcr_context { struct chcr_context {
@ -257,7 +257,7 @@ struct chcr_context {
unsigned int ntxq; unsigned int ntxq;
unsigned int nrxq; unsigned int nrxq;
struct completion cbc_aes_aio_done; struct completion cbc_aes_aio_done;
struct __crypto_ctx crypto_ctx[0]; struct __crypto_ctx crypto_ctx[];
}; };
struct chcr_hctx_per_wr { struct chcr_hctx_per_wr {