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

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>

+4 -4
+4 -4
drivers/crypto/chelsio/chcr_crypto.h
··· 223 223 224 224 struct __aead_ctx { 225 225 struct chcr_gcm_ctx gcm[0]; 226 - struct chcr_authenc_ctx authenc[0]; 226 + struct chcr_authenc_ctx authenc[]; 227 227 }; 228 228 229 229 struct chcr_aead_ctx { ··· 235 235 u8 nonce[4]; 236 236 u16 hmac_ctrl; 237 237 u16 mayverify; 238 - struct __aead_ctx ctx[0]; 238 + struct __aead_ctx ctx[]; 239 239 }; 240 240 241 241 struct hmac_ctx { ··· 247 247 struct __crypto_ctx { 248 248 struct hmac_ctx hmacctx[0]; 249 249 struct ablk_ctx ablkctx[0]; 250 - struct chcr_aead_ctx aeadctx[0]; 250 + struct chcr_aead_ctx aeadctx[]; 251 251 }; 252 252 253 253 struct chcr_context { ··· 257 257 unsigned int ntxq; 258 258 unsigned int nrxq; 259 259 struct completion cbc_aes_aio_done; 260 - struct __crypto_ctx crypto_ctx[0]; 260 + struct __crypto_ctx crypto_ctx[]; 261 261 }; 262 262 263 263 struct chcr_hctx_per_wr {