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

ima: 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>

+2 -2
+2 -2
security/integrity/integrity.h
··· 107 107 } ng; 108 108 u8 data[2]; 109 109 } xattr; 110 - u8 digest[0]; 110 + u8 digest[]; 111 111 } __packed; 112 112 113 113 /* ··· 119 119 uint8_t hash_algo; /* Digest algorithm [enum hash_algo] */ 120 120 __be32 keyid; /* IMA key identifier - not X509/PGP specific */ 121 121 __be16 sig_size; /* signature size */ 122 - uint8_t sig[0]; /* signature payload */ 122 + uint8_t sig[]; /* signature payload */ 123 123 } __packed; 124 124 125 125 /* integrity data associated with an inode */