[v4,02/10] cryptodev: replace zero length array with flex array

Message ID 20231120170942.197172-3-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
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. 20, 2023, 5:06 p.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>
---
 drivers/crypto/cnxk/cnxk_se.h | 5 ++++-
 lib/cryptodev/cryptodev_pmd.h | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
  

Comments

Anoob Joseph Nov. 21, 2023, 5:29 a.m. UTC | #1
> 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>
  

Patch

diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index c2a807fa9428..f86b859a08a4 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -29,8 +29,11 @@  enum cpt_dp_thread_type {
 	CPT_DP_THREAD_TYPE_PT,
 };
 
+#define SYM_SESS_SIZE sizeof(struct rte_cryptodev_sym_session)
+
 struct cnxk_se_sess {
-	struct rte_cryptodev_sym_session rte_sess;
+	uint8_t rte_sess[SYM_SESS_SIZE];
+
 	uint8_t aes_gcm : 1;
 	uint8_t aes_ccm : 1;
 	uint8_t aes_ctr : 1;
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 3bb3d95c1338..0732b356883c 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -153,7 +153,7 @@  struct rte_cryptodev_sym_session {
 
 	RTE_MARKER cacheline1 __rte_cache_min_aligned;
 	/**< Second cache line - start of the driver session data */
-	uint8_t driver_priv_data[0];
+	uint8_t driver_priv_data[];
 	/**< Driver specific session data, variable size */
 };