diff mbox series

[-next,1/4] ima: Use DECLARE_FLEX_ARRAY() helper in ima_modsig

Message ID 20220905075837.1083216-2-cuigaosheng1@huawei.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Use DECLARE_FLEX_ARRAY() helper for ima | expand

Commit Message

Gaosheng Cui Sept. 5, 2022, 7:58 a.m. UTC
Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members instead. So, replace zero-length array
declaration with the new DECLARE_FLEX_ARRAY() helper macro in struct
modsig.

This helper allows for a flexible-array member in a union.

Link: KSPP#21
Link: KSPP#193
Link: KSPP#197
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 security/integrity/ima/ima_modsig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mimi Zohar Sept. 23, 2022, 8:28 p.m. UTC | #1
Hi Gaosheng,

Thank you for the patches.

On Mon, 2022-09-05 at 15:58 +0800, Gaosheng Cui wrote:
> Zero-length arrays are deprecated and we are moving towards adopting
> C99 flexible-array members instead. So, replace zero-length array
> declaration with the new DECLARE_FLEX_ARRAY() helper macro in struct
> modsig.
> 
> This helper allows for a flexible-array member in a union.
> 
> Link: KSPP#21
> Link: KSPP#193
> Link: KSPP#197

The above shortened link is a bit confusing.  The #193 complete link is
mentioned in the cover letter.  In all cases being modified the "[]" 
notation is used.  Is this a boiler plate patch description or are all
three of these links really applicable to each of the patches?  

- Eliminate fake flexible arrays from the kernel ("variable length"
one-element and zero-length arrays) #21
- Replace fake flexible-array declarations with the
DECLARE_FLEX_ARRAY() helper macro #193
- Address -Wzero-length-array warnings reported by Clang #197

> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

Shouldn't this link be in the cover letter?  And the applicable
link(s), as shown in the cover letter, here in the patches?
diff mbox series

Patch

diff --git a/security/integrity/ima/ima_modsig.c b/security/integrity/ima/ima_modsig.c
index fb25723c65bc..d132383dbb64 100644
--- a/security/integrity/ima/ima_modsig.c
+++ b/security/integrity/ima/ima_modsig.c
@@ -29,7 +29,7 @@  struct modsig {
 	 * storing the signature.
 	 */
 	int raw_pkcs7_len;
-	u8 raw_pkcs7[];
+	DECLARE_FLEX_ARRAY(u8, raw_pkcs7);
 };
 
 /*