[v5,03/10] security: replace zero length array with flex array

Message ID 20231129024221.57653-4-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: Thomas Monjalon
Headers
Series Replace zero length arrays |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Nov. 29, 2023, 2:39 a.m. UTC
  Zero length arrays are GNU extension. Replace with
standard flex array.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 drivers/crypto/cnxk/cn10k_ipsec.h  | 4 +++-
 drivers/crypto/cnxk/cn9k_ipsec.h   | 4 +++-
 lib/security/rte_security_driver.h | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/crypto/cnxk/cn10k_ipsec.h b/drivers/crypto/cnxk/cn10k_ipsec.h
index 8a93d7406204..144bc8319dea 100644
--- a/drivers/crypto/cnxk/cn10k_ipsec.h
+++ b/drivers/crypto/cnxk/cn10k_ipsec.h
@@ -24,8 +24,10 @@  struct cn10k_ipsec_sa {
 	};
 } __rte_aligned(ROC_ALIGN);
 
+#define SEC_SESS_SIZE sizeof(struct rte_security_session)
+
 struct cn10k_sec_session {
-	struct rte_security_session rte_sess;
+	uint8_t rte_sess[SEC_SESS_SIZE];
 
 	/** PMD private space */
 
diff --git a/drivers/crypto/cnxk/cn9k_ipsec.h b/drivers/crypto/cnxk/cn9k_ipsec.h
index 1ea946afd8a9..d28642e3a627 100644
--- a/drivers/crypto/cnxk/cn9k_ipsec.h
+++ b/drivers/crypto/cnxk/cn9k_ipsec.h
@@ -20,8 +20,10 @@  struct cn9k_ipsec_sa {
 	};
 } __rte_aligned(8);
 
+#define SEC_SESS_SIZE sizeof(struct rte_security_session)
+
 struct cn9k_sec_session {
-	struct rte_security_session rte_sess;
+	uint8_t rte_sess[SEC_SESS_SIZE];
 
 	/** PMD private space */
 
diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h
index 62664dacdbb4..faa4074f1965 100644
--- a/lib/security/rte_security_driver.h
+++ b/lib/security/rte_security_driver.h
@@ -33,7 +33,7 @@  struct rte_security_session {
 	/**< session private data IOVA address */
 
 	RTE_MARKER cacheline1 __rte_cache_min_aligned;
-	uint8_t driver_priv_data[0];
+	uint8_t driver_priv_data[];
 	/**< Private session material, variable size (depends on driver) */
 };