All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gaosheng Cui <cuigaosheng1@huawei.com>
To: <zohar@linux.ibm.com>, <dmitry.kasatkin@gmail.com>,
	<paul@paul-moore.com>, <jmorris@namei.org>, <serge@hallyn.com>,
	<cuigaosheng1@huawei.com>
Cc: <linux-integrity@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: [PATCH -next 4/4] integrity: Use DECLARE_FLEX_ARRAY() helper in integrity.h
Date: Mon, 5 Sep 2022 15:58:37 +0800	[thread overview]
Message-ID: <20220905075837.1083216-5-cuigaosheng1@huawei.com> (raw)
In-Reply-To: <20220905075837.1083216-1-cuigaosheng1@huawei.com>

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@huawei.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


      parent reply	other threads:[~2022-09-05  7:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  7:58 [PATCH -next 0/4] Use DECLARE_FLEX_ARRAY() helper for ima Gaosheng Cui
2022-09-05  7:58 ` [PATCH -next 1/4] ima: Use DECLARE_FLEX_ARRAY() helper in ima_modsig Gaosheng Cui
2022-09-23 20:28   ` Mimi Zohar
2022-09-05  7:58 ` [PATCH -next 2/4] ima: Use DECLARE_FLEX_ARRAY() helper in ima_template_entry Gaosheng Cui
2022-09-05  7:58 ` [PATCH -next 3/4] ima: Use DECLARE_FLEX_ARRAY() helper in ima_policy Gaosheng Cui
2022-09-05  7:58 ` Gaosheng Cui [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220905075837.1083216-5-cuigaosheng1@huawei.com \
    --to=cuigaosheng1@huawei.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=jmorris@namei.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.