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

Gaosheng Cui cuigaosheng1 at huawei.com
Mon Sep 5 07:58:34 UTC 2022


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 at huawei.com>
---
 security/integrity/ima/ima_modsig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
 };
 
 /*
-- 
2.25.1



More information about the Linux-security-module-archive mailing list