lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220905075837.1083216-5-cuigaosheng1@huawei.com>
Date:   Mon, 5 Sep 2022 15:58:37 +0800
From:   Gaosheng Cui <cuigaosheng1@...wei.com>
To:     <zohar@...ux.ibm.com>, <dmitry.kasatkin@...il.com>,
        <paul@...l-moore.com>, <jmorris@...ei.org>, <serge@...lyn.com>,
        <cuigaosheng1@...wei.com>
CC:     <linux-integrity@...r.kernel.org>,
        <linux-security-module@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH -next 4/4] integrity: Use DECLARE_FLEX_ARRAY() helper in integrity.h

Zero-length arrays are deprecated and we are moving towards adopting
C99 flexible-array members instead. So, replace zero-length array
declarations with the new DECLARE_FLEX_ARRAY() helper macro in
integrity.h.

As follows:
	struct evm_ima_xattr_data,
	struct ima_digest_data,
	struct signature_v2_hdr,

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@...wei.com>
---
 security/integrity/integrity.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h
index 7167a6e99bdc..3eeea8d630e0 100644
--- a/security/integrity/integrity.h
+++ b/security/integrity/integrity.h
@@ -85,7 +85,7 @@ enum evm_ima_xattr_type {
 
 struct evm_ima_xattr_data {
 	u8 type;
-	u8 data[];
+	DECLARE_FLEX_ARRAY(u8, data);
 } __packed;
 
 /* Only used in the EVM HMAC code. */
@@ -110,7 +110,7 @@ struct ima_digest_data {
 		} ng;
 		u8 data[2];
 	} xattr;
-	u8 digest[];
+	DECLARE_FLEX_ARRAY(u8, digest);
 } __packed;
 
 /*
@@ -138,7 +138,7 @@ struct signature_v2_hdr {
 	uint8_t	hash_algo;	/* Digest algorithm [enum hash_algo] */
 	__be32 keyid;		/* IMA key identifier - not X509/PGP specific */
 	__be16 sig_size;	/* signature size */
-	uint8_t sig[];		/* signature payload */
+	DECLARE_FLEX_ARRAY(uint8_t, sig); /* signature payload */
 } __packed;
 
 /*
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ