* [PATCH 0/7] replace zero length arrays @ 2023-01-13 21:51 Stephen Hemminger 2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger ` (10 more replies) 0 siblings, 11 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:51 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Zero length arrays are a GNU extension that has been superseded by flex arrays. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html These are places found by cocci/zero_length_array.cocci Stephen Hemminger (7): member: replace zero length array with flex array cryptodev: replace zero length array with flex array security: replace zero length array with flex array mlx5: replace zero length array with flex array nfp: replace zero length array with flex array enic: replace zero length array with flex array dpaax: replace zero length array with flex array drivers/common/dpaax/caamflib/desc/ipsec.h | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 2 +- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- lib/cryptodev/cryptodev_pmd.h | 2 +- lib/member/rte_member_heap.h | 2 +- lib/security/rte_security_driver.h | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 1/7] member: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger @ 2023-01-13 21:51 ` Stephen Hemminger 2023-01-14 0:19 ` Tyler Retzlaff 2023-01-13 21:52 ` [PATCH 2/7] cryptodev: " Stephen Hemminger ` (9 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:51 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/member/rte_member_heap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h index 9c4a01aebe95..ab6319bc2de4 100644 --- a/lib/member/rte_member_heap.h +++ b/lib/member/rte_member_heap.h @@ -26,7 +26,7 @@ struct hash { uint16_t bkt_cnt; uint16_t num_item; uint32_t seed; - struct hash_bkt buckets[0]; + struct hash_bkt buckets[]; }; struct node { -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 1/7] member: replace zero length array with flex array 2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger @ 2023-01-14 0:19 ` Tyler Retzlaff 2023-01-14 0:36 ` Stephen Hemminger 0 siblings, 1 reply; 84+ messages in thread From: Tyler Retzlaff @ 2023-01-14 0:19 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Yipeng Wang, Sameh Gobriel On Fri, Jan 13, 2023 at 01:51:59PM -0800, Stephen Hemminger wrote: > Zero length arrays are GNU extension. Replace with > standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/member/rte_member_heap.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h > index 9c4a01aebe95..ab6319bc2de4 100644 > --- a/lib/member/rte_member_heap.h > +++ b/lib/member/rte_member_heap.h > @@ -26,7 +26,7 @@ struct hash { > uint16_t bkt_cnt; > uint16_t num_item; > uint32_t seed; > - struct hash_bkt buckets[0]; > + struct hash_bkt buckets[]; > }; > > struct node { > -- i suppose arguably this series depends on the series Bruce is putting up defaulting the minimum C standard to C99 since technically that's the minimum needed for the flexible array members. Series-acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 1/7] member: replace zero length array with flex array 2023-01-14 0:19 ` Tyler Retzlaff @ 2023-01-14 0:36 ` Stephen Hemminger 2023-01-14 0:42 ` Tyler Retzlaff 0 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-14 0:36 UTC (permalink / raw) To: Tyler Retzlaff; +Cc: dev, Yipeng Wang, Sameh Gobriel On Fri, 13 Jan 2023 16:19:21 -0800 Tyler Retzlaff <roretzla@linux.microsoft.com> wrote: > On Fri, Jan 13, 2023 at 01:51:59PM -0800, Stephen Hemminger wrote: > > Zero length arrays are GNU extension. Replace with > > standard flex array. > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > > --- > > lib/member/rte_member_heap.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h > > index 9c4a01aebe95..ab6319bc2de4 100644 > > --- a/lib/member/rte_member_heap.h > > +++ b/lib/member/rte_member_heap.h > > @@ -26,7 +26,7 @@ struct hash { > > uint16_t bkt_cnt; > > uint16_t num_item; > > uint32_t seed; > > - struct hash_bkt buckets[0]; > > + struct hash_bkt buckets[]; > > }; > > > > struct node { > > -- > > i suppose arguably this series depends on the series Bruce is putting > up defaulting the minimum C standard to C99 since technically that's the > minimum needed for the flexible array members. > > Series-acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > There is already flex array usage in several places in DPDK. Therefore this won't be raising the requirements. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 1/7] member: replace zero length array with flex array 2023-01-14 0:36 ` Stephen Hemminger @ 2023-01-14 0:42 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-01-14 0:42 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Yipeng Wang, Sameh Gobriel On Fri, Jan 13, 2023 at 04:36:10PM -0800, Stephen Hemminger wrote: > On Fri, 13 Jan 2023 16:19:21 -0800 > Tyler Retzlaff <roretzla@linux.microsoft.com> wrote: > > > On Fri, Jan 13, 2023 at 01:51:59PM -0800, Stephen Hemminger wrote: > > > Zero length arrays are GNU extension. Replace with > > > standard flex array. > > > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > > > --- > > > lib/member/rte_member_heap.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h > > > index 9c4a01aebe95..ab6319bc2de4 100644 > > > --- a/lib/member/rte_member_heap.h > > > +++ b/lib/member/rte_member_heap.h > > > @@ -26,7 +26,7 @@ struct hash { > > > uint16_t bkt_cnt; > > > uint16_t num_item; > > > uint32_t seed; > > > - struct hash_bkt buckets[0]; > > > + struct hash_bkt buckets[]; > > > }; > > > > > > struct node { > > > -- > > > > i suppose arguably this series depends on the series Bruce is putting > > up defaulting the minimum C standard to C99 since technically that's the > > minimum needed for the flexible array members. > > > > Series-acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > > > > There is already flex array usage in several places in DPDK. > Therefore this won't be raising the requirements. agreed. ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 2/7] cryptodev: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger 2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-13 21:52 ` [PATCH 3/7] security: " Stephen Hemminger ` (8 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Fan Zhang Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/cryptodev/cryptodev_pmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h index 0020102eb7db..ffca31db4a96 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 */ }; -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 3/7] security: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger 2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger 2023-01-13 21:52 ` [PATCH 2/7] cryptodev: " Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-13 21:52 ` [PATCH 4/7] mlx5: " Stephen Hemminger ` (7 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/security/rte_security_driver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/security/rte_security_driver.h b/lib/security/rte_security_driver.h index 421e6f778067..ff6a33369a08 100644 --- a/lib/security/rte_security_driver.h +++ b/lib/security/rte_security_driver.h @@ -34,7 +34,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) */ }; -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 4/7] mlx5: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (2 preceding siblings ...) 2023-01-13 21:52 ` [PATCH 3/7] security: " Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-14 17:08 ` Stephen Hemminger 2023-01-13 21:52 ` [PATCH 5/7] nfp: " Stephen Hemminger ` (6 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Matan Azrad, Viacheslav Ovsiienko Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 31982002ee9b..2b295f9ba037 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1273,7 +1273,7 @@ struct mlx5_aso_ct_pool { }; struct mlx5_aso_sq *sq; /* Async ASO SQ. */ struct mlx5_aso_sq *shared_sq; /* Shared ASO SQ. */ - struct mlx5_aso_ct_action actions[0]; + struct mlx5_aso_ct_action actions[]; /* CT action structures bulk. */ }; @@ -1290,7 +1290,7 @@ struct mlx5_aso_ct_pools_mng { rte_spinlock_t ct_sl; /* The ASO CT free list lock. */ rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ struct aso_ct_list free_cts; /* Free ASO CT objects list. */ - struct mlx5_aso_sq aso_sqs[0]; /* ASO queue objects. */ + struct mlx5_aso_sq aso_sqs[]; /* ASO queue objects. */ }; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 1f57ecd6e1c1..e12efab211d2 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1149,7 +1149,7 @@ struct rte_flow_hw { uint32_t age_idx; cnt_id_t cnt_id; uint32_t mtr_id; - uint8_t rule[0]; /* HWS layer data struct. */ + uint8_t rule[]; /* HWS layer data struct. */ } __rte_packed; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index a44050a1cec3..d026e8126a75 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -166,7 +166,7 @@ struct mlx5_txq_data { struct mlx5_txq_stats stats; /* TX queue counters. */ struct mlx5_txq_stats stats_reset; /* stats on last reset. */ struct mlx5_uar_data uar_data; - struct rte_mbuf *elts[0]; + struct rte_mbuf * elts[]; /* Storage for queued packets, must be the last field. */ } __rte_cache_aligned; -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 4/7] mlx5: replace zero length array with flex array 2023-01-13 21:52 ` [PATCH 4/7] mlx5: " Stephen Hemminger @ 2023-01-14 17:08 ` Stephen Hemminger 2023-03-06 13:29 ` Slava Ovsiienko 0 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-14 17:08 UTC (permalink / raw) To: dev; +Cc: Matan Azrad, Viacheslav Ovsiienko On Fri, 13 Jan 2023 13:52:02 -0800 Stephen Hemminger <stephen@networkplumber.org> wrote: > Zero length arrays are GNU extension. Replace with > standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- Since Mlx driver enables pedantic checking, this causes build failure on some versions of gcc. In file included from ../drivers/net/mlx5/mlx5.c:40: ../drivers/net/mlx5/mlx5_tx.h:187:23: error: invalid use of structure with flexible array member [-Werror=pedantic] 187 | struct mlx5_txq_data txq; /* Data path structure. */ | ^~~ Understand that the driver wants to enable more checking since Nvidia does good job of keeping the code up to date. But having driver specific compiler flags like this creates more unnecessary complexity and doesn't improve the resulting code. ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH 4/7] mlx5: replace zero length array with flex array 2023-01-14 17:08 ` Stephen Hemminger @ 2023-03-06 13:29 ` Slava Ovsiienko 0 siblings, 0 replies; 84+ messages in thread From: Slava Ovsiienko @ 2023-03-06 13:29 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Matan Azrad Hi, Stephen IIUC - for now all of the compilers claimed for DPDK compilation support the zero-length-array and we do not have an issue ? We could eliminate this GNU extension and have workaround, like this: /* Verbs headers do not support -pedantic. */ #ifdef PEDANTIC #pragma GCC diagnostic ignored "-Wpedantic" #endif #include <infiniband/mlx5dv.h> #include <infiniband/verbs.h> #ifdef PEDANTIC #pragma GCC diagnostic error "-Wpedantic" #endif I'm not sure this would make code more readable. Should we do this WA? With best regards, Slava > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: суббота, 14 января 2023 г. 19:08 > To: dev@dpdk.org > Cc: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko > <viacheslavo@nvidia.com> > Subject: Re: [PATCH 4/7] mlx5: replace zero length array with flex array > > On Fri, 13 Jan 2023 13:52:02 -0800 > Stephen Hemminger <stephen@networkplumber.org> wrote: > > > Zero length arrays are GNU extension. Replace with standard flex > > array. > > > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > > --- > > > Since Mlx driver enables pedantic checking, this causes build failure on some > versions of gcc. > > In file included from ../drivers/net/mlx5/mlx5.c:40: > ../drivers/net/mlx5/mlx5_tx.h:187:23: error: invalid use of structure with > flexible array member [-Werror=pedantic] > 187 | struct mlx5_txq_data txq; /* Data path structure. */ > | ^~~ > > > Understand that the driver wants to enable more checking since Nvidia does > good job of keeping the code up to date. But having driver specific compiler > flags like this creates more unnecessary complexity and doesn't improve the > resulting code. ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 5/7] nfp: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (3 preceding siblings ...) 2023-01-13 21:52 ` [PATCH 4/7] mlx5: " Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-15 15:22 ` Niklas Söderlund 2023-01-13 21:52 ` [PATCH 6/7] enic: " Stephen Hemminger ` (5 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Chaoyong He, Niklas Söderlund Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 04601cb0bd25..ee8b439d617f 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { uint8_t info; uint8_t nbi_port; uint8_t phys_port; - } ports[0]; + } ports[]; }; /* -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 5/7] nfp: replace zero length array with flex array 2023-01-13 21:52 ` [PATCH 5/7] nfp: " Stephen Hemminger @ 2023-01-15 15:22 ` Niklas Söderlund 0 siblings, 0 replies; 84+ messages in thread From: Niklas Söderlund @ 2023-01-15 15:22 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Chaoyong He Hi Stephen, Thanks for your patch. On 2023-01-13 13:52:03 -0800, Stephen Hemminger wrote: > Zero length arrays are GNU extension. Replace with > standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> I understand this works might depend on another work to raise the minimum compiler versions to support this change. Provided this is sorted out as part of the full series to move to flex arrays, for the change itself. Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> > --- > drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h > index 04601cb0bd25..ee8b439d617f 100644 > --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h > +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h > @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { > uint8_t info; > uint8_t nbi_port; > uint8_t phys_port; > - } ports[0]; > + } ports[]; > }; > > /* > -- > 2.39.0 > -- Kind Regards, Niklas Söderlund ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 6/7] enic: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (4 preceding siblings ...) 2023-01-13 21:52 ` [PATCH 5/7] nfp: " Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-14 1:12 ` John Daley (johndale) 2023-01-13 21:52 ` [PATCH 7/7] dpaax: " Stephen Hemminger ` (4 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, John Daley, Hyong Youb Kim Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/enic/base/vnic_devcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index 253a791c3f65..f91cc3078d63 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -765,7 +765,7 @@ struct vnic_devcmd_notify { struct vnic_devcmd_provinfo { uint8_t oui[3]; uint8_t type; - uint8_t data[0]; + uint8_t data[]; }; /* -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH 6/7] enic: replace zero length array with flex array 2023-01-13 21:52 ` [PATCH 6/7] enic: " Stephen Hemminger @ 2023-01-14 1:12 ` John Daley (johndale) 0 siblings, 0 replies; 84+ messages in thread From: John Daley (johndale) @ 2023-01-14 1:12 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Stephen Hemminger, Hyong Youb Kim (hyonkim) [-- Attachment #1: Type: text/plain, Size: 1047 bytes --] Acked-by: John Daley <johndale@cisco.com> From: Stephen Hemminger <stephen@networkplumber.org> Date: Friday, January 13, 2023 at 1:52 PM To: dev@dpdk.org <dev@dpdk.org> Cc: Stephen Hemminger <stephen@networkplumber.org>, John Daley (johndale) <johndale@cisco.com>, Hyong Youb Kim (hyonkim) <hyonkim@cisco.com> Subject: [PATCH 6/7] enic: replace zero length array with flex array Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/enic/base/vnic_devcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index 253a791c3f65..f91cc3078d63 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -765,7 +765,7 @@ struct vnic_devcmd_notify { struct vnic_devcmd_provinfo { uint8_t oui[3]; uint8_t type; - uint8_t data[0]; + uint8_t data[]; }; /* -- 2.39.0 [-- Attachment #2: Type: text/html, Size: 3221 bytes --] ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH 7/7] dpaax: replace zero length array with flex array 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (5 preceding siblings ...) 2023-01-13 21:52 ` [PATCH 6/7] enic: " Stephen Hemminger @ 2023-01-13 21:52 ` Stephen Hemminger 2023-01-15 11:59 ` Hemant Agrawal 2023-01-14 10:43 ` [PATCH 0/7] replace zero length arrays Morten Brørup ` (3 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-01-13 21:52 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/dpaax/caamflib/desc/ipsec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h index 8ec6aac915b4..2c9080a1b51d 100644 --- a/drivers/common/dpaax/caamflib/desc/ipsec.h +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h @@ -350,7 +350,7 @@ struct ipsec_encap_pdb { }; uint32_t spi; uint32_t ip_hdr_len; - uint8_t ip_hdr[0]; + uint8_t ip_hdr[]; }; static inline unsigned int -- 2.39.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH 7/7] dpaax: replace zero length array with flex array 2023-01-13 21:52 ` [PATCH 7/7] dpaax: " Stephen Hemminger @ 2023-01-15 11:59 ` Hemant Agrawal 0 siblings, 0 replies; 84+ messages in thread From: Hemant Agrawal @ 2023-01-15 11:59 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Sachin Saxena Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH 0/7] replace zero length arrays 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (6 preceding siblings ...) 2023-01-13 21:52 ` [PATCH 7/7] dpaax: " Stephen Hemminger @ 2023-01-14 10:43 ` Morten Brørup 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (2 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Morten Brørup @ 2023-01-14 10:43 UTC (permalink / raw) To: Stephen Hemminger, dev > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, 13 January 2023 22.52 > > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci Series-acked-by: Morten Brørup <mb@smartsharesystems.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 00/10] replace zero length arrays 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (7 preceding siblings ...) 2023-01-14 10:43 ` [PATCH 0/7] replace zero length arrays Morten Brørup @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:03 ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger ` (10 more replies) 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger 10 siblings, 11 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Zero length arrays are a GNU extension that has been superseded by flex arrays. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html These are places found by cocci/zero_length_array.cocci v2 - rebased on 23.11-rc3 more places started using zero length array Stephen Hemminger (10): member: replace zero length array with flex array cryptodev: replace zero length array with flex array security: replace zero length array with flex array pipeline: replace zero length array with flex array net/nfp: replace zero length array with flex array net/enic: replace zero length array with flex array net/mlx5: replace zero length array with flex array pdcp: replace zero length array with flex array net/cpfl: replace zero length array with flex array common/dpaxx: replace zero length array with flex array drivers/common/dpaax/caamflib/desc/ipsec.h | 2 +- drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 2 +- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- lib/cryptodev/cryptodev_pmd.h | 2 +- lib/member/rte_member_heap.h | 2 +- lib/pdcp/pdcp_entity.h | 2 +- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/security/rte_security_driver.h | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 01/10] member: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:17 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 02/10] cryptodev: " Stephen Hemminger ` (9 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Yipeng Wang, Sameh Gobriel Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/member/rte_member_heap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h index 9c4a01aebe95..ab6319bc2de4 100644 --- a/lib/member/rte_member_heap.h +++ b/lib/member/rte_member_heap.h @@ -26,7 +26,7 @@ struct hash { uint16_t bkt_cnt; uint16_t num_item; uint32_t seed; - struct hash_bkt buckets[0]; + struct hash_bkt buckets[]; }; struct node { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 01/10] member: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger @ 2023-11-17 4:17 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:17 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Yipeng Wang, Sameh Gobriel On Thu, Nov 16, 2023 at 08:03:13PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 02/10] cryptodev: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger 2023-11-17 4:03 ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:18 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 03/10] security: " Stephen Hemminger ` (8 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Fan Zhang Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/cryptodev/cryptodev_pmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 02/10] cryptodev: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 02/10] cryptodev: " Stephen Hemminger @ 2023-11-17 4:18 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:18 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Akhil Goyal, Fan Zhang On Thu, Nov 16, 2023 at 08:03:14PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 03/10] security: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger 2023-11-17 4:03 ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-17 4:03 ` [PATCH v2 02/10] cryptodev: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:18 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 04/10] pipeline: " Stephen Hemminger ` (7 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/security/rte_security_driver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 03/10] security: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 03/10] security: " Stephen Hemminger @ 2023-11-17 4:18 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:18 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Akhil Goyal On Thu, Nov 16, 2023 at 08:03:15PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 04/10] pipeline: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (2 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 03/10] security: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:19 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 05/10] net/nfp: " Stephen Hemminger ` (6 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h index a67b6e965de7..8ec12263b989 100644 --- a/lib/pipeline/rte_swx_pipeline_internal.h +++ b/lib/pipeline/rte_swx_pipeline_internal.h @@ -213,7 +213,7 @@ TAILQ_HEAD(rss_tailq, rss); struct rss_runtime { uint32_t key_size; /* key size in bytes. */ - uint8_t key[0]; /* key. */ + uint8_t key[]; /* key. */ }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 04/10] pipeline: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 04/10] pipeline: " Stephen Hemminger @ 2023-11-17 4:19 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:19 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Cristian Dumitrescu On Thu, Nov 16, 2023 at 08:03:16PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 05/10] net/nfp: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (3 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 04/10] pipeline: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:19 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 06/10] net/enic: " Stephen Hemminger ` (5 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Niklas Söderlund, Chaoyong He Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index c2938fb6f63c..f00d2e838d8f 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { uint8_t info; uint8_t nbi_port; uint8_t phys_port; - } ports[0]; + } ports[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 05/10] net/nfp: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 05/10] net/nfp: " Stephen Hemminger @ 2023-11-17 4:19 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:19 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Niklas Söderlund, Chaoyong He On Thu, Nov 16, 2023 at 08:03:17PM -0800, Stephen Hemminger wrote: > Zero length arrays are GNU extension. Replace with > standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> > --- Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 06/10] net/enic: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (4 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 05/10] net/nfp: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 07/10] net/mlx5: " Stephen Hemminger ` (4 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, John Daley, Hyong Youb Kim Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: John Daley <johndale@cisco.com> --- drivers/net/enic/base/vnic_devcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index 253a791c3f65..f91cc3078d63 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -765,7 +765,7 @@ struct vnic_devcmd_notify { struct vnic_devcmd_provinfo { uint8_t oui[3]; uint8_t type; - uint8_t data[0]; + uint8_t data[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 06/10] net/enic: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 06/10] net/enic: " Stephen Hemminger @ 2023-11-17 4:20 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:20 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, John Daley, Hyong Youb Kim On Thu, Nov 16, 2023 at 08:03:18PM -0800, Stephen Hemminger wrote: > Zero length arrays are GNU extension. Replace with > standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > Acked-by: John Daley <johndale@cisco.com> > --- Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 07/10] net/mlx5: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (5 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 06/10] net/enic: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 08/10] pdcp: " Stephen Hemminger ` (3 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Dariusz Sosnowski, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 9e22dce6da13..932b89bd79d3 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -5181,7 +5181,7 @@ struct mlx5_ifc_flow_context_bits { u8 reserved_at_e0[0x40]; u8 encrypt_decrypt_obj_id[0x20]; u8 reserved_at_140[0x16c0]; - union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0]; + union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[]; }; struct mlx5_ifc_set_fte_in_bits { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f0d63a0ba5f5..89d13900fd3c 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1308,7 +1308,7 @@ struct mlx5_aso_ct_pool { }; struct mlx5_aso_sq *sq; /* Async ASO SQ. */ struct mlx5_aso_sq *shared_sq; /* Shared ASO SQ. */ - struct mlx5_aso_ct_action actions[0]; + struct mlx5_aso_ct_action actions[]; /* CT action structures bulk. */ }; @@ -1325,7 +1325,7 @@ struct mlx5_aso_ct_pools_mng { rte_spinlock_t ct_sl; /* The ASO CT free list lock. */ rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ struct aso_ct_list free_cts; /* Free ASO CT objects list. */ - struct mlx5_aso_sq aso_sqs[0]; /* ASO queue objects. */ + struct mlx5_aso_sq aso_sqs[]; /* ASO queue objects. */ }; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 6dde9de688b9..b35079b30a6e 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1257,7 +1257,7 @@ struct rte_flow_hw { cnt_id_t cnt_id; uint32_t mtr_id; uint32_t rule_idx; - uint8_t rule[0]; /* HWS layer data struct. */ + uint8_t rule[]; /* HWS layer data struct. */ } __rte_packed; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index e59ce37667ba..2045e5174e6d 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -171,7 +171,7 @@ struct mlx5_txq_data { struct mlx5_txq_stats stats; /* TX queue counters. */ struct mlx5_txq_stats stats_reset; /* stats on last reset. */ struct mlx5_uar_data uar_data; - struct rte_mbuf *elts[0]; + struct rte_mbuf *elts[]; /* Storage for queued packets, must be the last field. */ } __rte_cache_aligned; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 07/10] net/mlx5: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 07/10] net/mlx5: " Stephen Hemminger @ 2023-11-17 4:20 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:20 UTC (permalink / raw) To: Stephen Hemminger Cc: dev, Dariusz Sosnowski, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad On Thu, Nov 16, 2023 at 08:03:19PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 08/10] pdcp: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (6 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 07/10] net/mlx5: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 5:28 ` [EXT] " Anoob Joseph 2023-11-17 4:03 ` [PATCH v2 09/10] net/cpfl: " Stephen Hemminger ` (2 subsequent siblings) 10 siblings, 2 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Anoob Joseph, Volodymyr Fialko Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pdcp/pdcp_entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h index 4fc6342a5ced..f854192e98dc 100644 --- a/lib/pdcp/pdcp_entity.h +++ b/lib/pdcp/pdcp_entity.h @@ -185,7 +185,7 @@ struct entity_priv_dl_part { /** Reorder packet buffer */ struct pdcp_reorder reorder; /** Bitmap memory region */ - uint8_t bitmap_mem[0]; + uint8_t bitmap_mem[]; }; struct entity_priv_ul_part { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 08/10] pdcp: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 08/10] pdcp: " Stephen Hemminger @ 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 5:28 ` [EXT] " Anoob Joseph 1 sibling, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:20 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Anoob Joseph, Volodymyr Fialko On Thu, Nov 16, 2023 at 08:03:20PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [EXT] [PATCH v2 08/10] pdcp: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 08/10] pdcp: " Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff @ 2023-11-17 5:28 ` Anoob Joseph 1 sibling, 0 replies; 84+ messages in thread From: Anoob Joseph @ 2023-11-17 5:28 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Volodymyr Fialko > Zero length arrays are GNU extension. Replace with standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Anoob Joseph <anoobj@marvell.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 09/10] net/cpfl: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (7 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 08/10] pdcp: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 10/10] common/dpaxx: " Stephen Hemminger 2023-11-17 8:31 ` [PATCH v2 00/10] replace zero length arrays Morten Brørup 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Yuying Zhang, Beilei Xing Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c index 8a4e1419b4db..39a281fa61ee 100644 --- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c +++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c @@ -53,7 +53,7 @@ struct cpfl_rule_info_meta { uint32_t pr_num; /* number of pattern rules */ uint32_t mr_num; /* number of modification rules */ uint32_t rule_num; /* number of all rules */ - struct cpfl_rule_info rules[0]; + struct cpfl_rule_info rules[]; }; static uint32_t cpfl_fxp_mod_idx_alloc(struct cpfl_adapter_ext *ad); -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 09/10] net/cpfl: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 09/10] net/cpfl: " Stephen Hemminger @ 2023-11-17 4:20 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:20 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Yuying Zhang, Beilei Xing On Thu, Nov 16, 2023 at 08:03:21PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v2 10/10] common/dpaxx: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (8 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 09/10] net/cpfl: " Stephen Hemminger @ 2023-11-17 4:03 ` Stephen Hemminger 2023-11-17 4:21 ` Tyler Retzlaff 2023-11-17 8:31 ` [PATCH v2 00/10] replace zero length arrays Morten Brørup 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 4:03 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/dpaax/caamflib/desc/ipsec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h index 95fc3ea5ba3b..7bd82e4d0639 100644 --- a/drivers/common/dpaax/caamflib/desc/ipsec.h +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h @@ -350,7 +350,7 @@ struct ipsec_encap_pdb { }; uint32_t spi; uint32_t ip_hdr_len; - uint8_t ip_hdr[0]; + uint8_t ip_hdr[]; }; static inline unsigned int -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 10/10] common/dpaxx: replace zero length array with flex array 2023-11-17 4:03 ` [PATCH v2 10/10] common/dpaxx: " Stephen Hemminger @ 2023-11-17 4:21 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 4:21 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Hemant Agrawal, Sachin Saxena On Thu, Nov 16, 2023 at 08:03:22PM -0800, Stephen Hemminger wrote: > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v2 00/10] replace zero length arrays 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger ` (9 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 10/10] common/dpaxx: " Stephen Hemminger @ 2023-11-17 8:31 ` Morten Brørup 2023-11-17 16:18 ` Stephen Hemminger 10 siblings, 1 reply; 84+ messages in thread From: Morten Brørup @ 2023-11-17 8:31 UTC (permalink / raw) To: Stephen Hemminger, dev > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, 17 November 2023 05.03 > > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci Series-acked-by: Morten Brørup <mb@smartsharesystems.com> Suggest checkpatches to disallow this, if it doesn't already. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 00/10] replace zero length arrays 2023-11-17 8:31 ` [PATCH v2 00/10] replace zero length arrays Morten Brørup @ 2023-11-17 16:18 ` Stephen Hemminger 2023-11-17 19:59 ` Tyler Retzlaff 0 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-17 16:18 UTC (permalink / raw) To: Morten Brørup; +Cc: dev On Fri, 17 Nov 2023 09:31:11 +0100 Morten Brørup <mb@smartsharesystems.com> wrote: > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> > > Suggest checkpatches to disallow this, if it doesn't already. Unfortunately, matching this with awk is too hard. Coccinelle can do it but don't want to introduce dependency on that. Maybe a compiler flag would be possible, but could not find one. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v2 00/10] replace zero length arrays 2023-11-17 16:18 ` Stephen Hemminger @ 2023-11-17 19:59 ` Tyler Retzlaff 0 siblings, 0 replies; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-17 19:59 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Morten Brørup, dev On Fri, Nov 17, 2023 at 08:18:23AM -0800, Stephen Hemminger wrote: > On Fri, 17 Nov 2023 09:31:11 +0100 > Morten Brørup <mb@smartsharesystems.com> wrote: > > > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> > > > > Suggest checkpatches to disallow this, if it doesn't already. > > Unfortunately, matching this with awk is too hard. Coccinelle can do it > but don't want to introduce dependency on that. > > Maybe a compiler flag would be possible, but could not find one. -pedantic will warn, but to use it without clobbering the build with warnings we would probably need to qualify all use of non-standard extensions with the __extension__ keyword. ``` struct foo { int a; int b; char buffer[0]; }; ``` zhora ~> gcc -Wall -pedantic oink.c oink.c:7:14: warning: ISO C forbids zero-size array ‘buffer’ [-Wpedantic] 7 | char buffer[0]; ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 00/10] Replace zero length arrays 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (8 preceding siblings ...) 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger @ 2023-11-20 17:06 ` Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 01/10] member: replace zero length array with flex array Stephen Hemminger ` (10 more replies) 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger 10 siblings, 11 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:06 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Zero length arrays are a GNU extension that has been superseded by flex arrays. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html These are places found by cocci/zero_length_array.cocci v4 - fix issues reported by clang where zero length array was embedded in security structures in cn10k and txq being embedded in mlx5 was missing extension Stephen Hemminger (10): member: replace zero length array with flex array cryptodev: replace zero length array with flex array security: replace zero length array with flex array pipeline: replace zero length array with flex array net/nfp: replace zero length array with flex array net/enic: replace zero length array with flex array net/mlx5: replace zero length array with flex array pdcp: replace zero length array with flex array net/cpfl: replace zero length array with flex array common/dpaxx: remove zero length array drivers/common/dpaax/caamflib/desc/ipsec.h | 6 ++---- drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/crypto/cnxk/cn10k_ipsec.h | 4 +++- drivers/crypto/cnxk/cn9k_ipsec.h | 4 +++- drivers/crypto/cnxk/cnxk_se.h | 5 ++++- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 3 ++- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- lib/cryptodev/cryptodev_pmd.h | 2 +- lib/member/rte_member_heap.h | 2 +- lib/pdcp/pdcp_entity.h | 2 +- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/security/rte_security_driver.h | 2 +- 16 files changed, 26 insertions(+), 20 deletions(-) -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 01/10] member: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger @ 2023-11-20 17:06 ` Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 02/10] cryptodev: " Stephen Hemminger ` (9 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:06 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Yipeng Wang, Sameh Gobriel 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> --- lib/member/rte_member_heap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h index 9c4a01aebe95..ab6319bc2de4 100644 --- a/lib/member/rte_member_heap.h +++ b/lib/member/rte_member_heap.h @@ -26,7 +26,7 @@ struct hash { uint16_t bkt_cnt; uint16_t num_item; uint32_t seed; - struct hash_bkt buckets[0]; + struct hash_bkt buckets[]; }; struct node { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 02/10] cryptodev: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 01/10] member: replace zero length array with flex array Stephen Hemminger @ 2023-11-20 17:06 ` Stephen Hemminger 2023-11-21 5:29 ` [EXT] " Anoob Joseph 2023-11-20 17:06 ` [PATCH v4 03/10] security: " Stephen Hemminger ` (8 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:06 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Akhil Goyal, Fan Zhang 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(-) 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 */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [EXT] [PATCH v4 02/10] cryptodev: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 02/10] cryptodev: " Stephen Hemminger @ 2023-11-21 5:29 ` Anoob Joseph 0 siblings, 0 replies; 84+ messages in thread From: Anoob Joseph @ 2023-11-21 5:29 UTC (permalink / raw) To: Stephen Hemminger, dev Cc: Tyler Retzlaff, Ankur Dwivedi, Tejasree Kondoj, Akhil Goyal, Fan Zhang > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 03/10] security: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 02/10] cryptodev: " Stephen Hemminger @ 2023-11-20 17:06 ` Stephen Hemminger 2023-11-21 5:30 ` [EXT] " Anoob Joseph 2023-11-20 17:06 ` [PATCH v4 04/10] pipeline: " Stephen Hemminger ` (7 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:06 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Akhil Goyal 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/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(-) 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) */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [EXT] [PATCH v4 03/10] security: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 03/10] security: " Stephen Hemminger @ 2023-11-21 5:30 ` Anoob Joseph 0 siblings, 0 replies; 84+ messages in thread From: Anoob Joseph @ 2023-11-21 5:30 UTC (permalink / raw) To: Stephen Hemminger, dev Cc: Tyler Retzlaff, Ankur Dwivedi, Tejasree Kondoj, Akhil Goyal > 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> ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 04/10] pipeline: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (2 preceding siblings ...) 2023-11-20 17:06 ` [PATCH v4 03/10] security: " Stephen Hemminger @ 2023-11-20 17:06 ` Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 05/10] net/nfp: " Stephen Hemminger ` (6 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:06 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Cristian Dumitrescu 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> --- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h index a67b6e965de7..8ec12263b989 100644 --- a/lib/pipeline/rte_swx_pipeline_internal.h +++ b/lib/pipeline/rte_swx_pipeline_internal.h @@ -213,7 +213,7 @@ TAILQ_HEAD(rss_tailq, rss); struct rss_runtime { uint32_t key_size; /* key size in bytes. */ - uint8_t key[0]; /* key. */ + uint8_t key[]; /* key. */ }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 05/10] net/nfp: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (3 preceding siblings ...) 2023-11-20 17:06 ` [PATCH v4 04/10] pipeline: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-21 1:14 ` Chaoyong He 2023-11-20 17:07 ` [PATCH v4 06/10] net/enic: " Stephen Hemminger ` (5 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Niklas Söderlund, Tyler Retzlaff, Chaoyong He Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index c2938fb6f63c..f00d2e838d8f 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { uint8_t info; uint8_t nbi_port; uint8_t phys_port; - } ports[0]; + } ports[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 05/10] net/nfp: replace zero length array with flex array 2023-11-20 17:07 ` [PATCH v4 05/10] net/nfp: " Stephen Hemminger @ 2023-11-21 1:14 ` Chaoyong He 0 siblings, 0 replies; 84+ messages in thread From: Chaoyong He @ 2023-11-21 1:14 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Tyler Retzlaff Acked-by: Chaoyong He <chaoyong.he@corigine.com> > Zero length arrays are GNU extension. Replace with standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> > Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > --- > drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h > b/drivers/net/nfp/flower/nfp_flower_cmsg.h > index c2938fb6f63c..f00d2e838d8f 100644 > --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h > +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h > @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { > uint8_t info; > uint8_t nbi_port; > uint8_t phys_port; > - } ports[0]; > + } ports[]; > }; > > /* > -- > 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 06/10] net/enic: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (4 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 05/10] net/nfp: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 07/10] net/mlx5: " Stephen Hemminger ` (4 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, John Daley, Tyler Retzlaff, Hyong Youb Kim Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: John Daley <johndale@cisco.com> Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- drivers/net/enic/base/vnic_devcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index 253a791c3f65..f91cc3078d63 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -765,7 +765,7 @@ struct vnic_devcmd_notify { struct vnic_devcmd_provinfo { uint8_t oui[3]; uint8_t type; - uint8_t data[0]; + uint8_t data[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 07/10] net/mlx5: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (5 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 06/10] net/enic: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-23 17:54 ` Dariusz Sosnowski 2023-11-20 17:07 ` [PATCH v4 08/10] pdcp: " Stephen Hemminger ` (3 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Dariusz Sosnowski, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad 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/common/mlx5/mlx5_prm.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 9e22dce6da13..932b89bd79d3 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -5181,7 +5181,7 @@ struct mlx5_ifc_flow_context_bits { u8 reserved_at_e0[0x40]; u8 encrypt_decrypt_obj_id[0x20]; u8 reserved_at_140[0x16c0]; - union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0]; + union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[]; }; struct mlx5_ifc_set_fte_in_bits { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f0d63a0ba5f5..89d13900fd3c 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1308,7 +1308,7 @@ struct mlx5_aso_ct_pool { }; struct mlx5_aso_sq *sq; /* Async ASO SQ. */ struct mlx5_aso_sq *shared_sq; /* Shared ASO SQ. */ - struct mlx5_aso_ct_action actions[0]; + struct mlx5_aso_ct_action actions[]; /* CT action structures bulk. */ }; @@ -1325,7 +1325,7 @@ struct mlx5_aso_ct_pools_mng { rte_spinlock_t ct_sl; /* The ASO CT free list lock. */ rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ struct aso_ct_list free_cts; /* Free ASO CT objects list. */ - struct mlx5_aso_sq aso_sqs[0]; /* ASO queue objects. */ + struct mlx5_aso_sq aso_sqs[]; /* ASO queue objects. */ }; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 6dde9de688b9..b35079b30a6e 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1257,7 +1257,7 @@ struct rte_flow_hw { cnt_id_t cnt_id; uint32_t mtr_id; uint32_t rule_idx; - uint8_t rule[0]; /* HWS layer data struct. */ + uint8_t rule[]; /* HWS layer data struct. */ } __rte_packed; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index e59ce37667ba..b1e8ea19a2a1 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -171,11 +171,12 @@ struct mlx5_txq_data { struct mlx5_txq_stats stats; /* TX queue counters. */ struct mlx5_txq_stats stats_reset; /* stats on last reset. */ struct mlx5_uar_data uar_data; - struct rte_mbuf *elts[0]; + struct rte_mbuf *elts[]; /* Storage for queued packets, must be the last field. */ } __rte_cache_aligned; /* TX queue control descriptor. */ +__extension__ struct mlx5_txq_ctrl { LIST_ENTRY(mlx5_txq_ctrl) next; /* Pointer to the next element. */ uint32_t refcnt; /* Reference counter. */ -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 07/10] net/mlx5: replace zero length array with flex array 2023-11-20 17:07 ` [PATCH v4 07/10] net/mlx5: " Stephen Hemminger @ 2023-11-23 17:54 ` Dariusz Sosnowski 0 siblings, 0 replies; 84+ messages in thread From: Dariusz Sosnowski @ 2023-11-23 17:54 UTC (permalink / raw) To: Stephen Hemminger Cc: Tyler Retzlaff, Slava Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad, dev Hi, > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Monday, November 20, 2023 18:07 > Subject: [PATCH v4 07/10] net/mlx5: replace zero length array with flex array > > 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/common/mlx5/mlx5_prm.h | 2 +- > drivers/net/mlx5/mlx5.h | 4 ++-- > drivers/net/mlx5/mlx5_flow.h | 2 +- > drivers/net/mlx5/mlx5_tx.h | 3 ++- > 4 files changed, 6 insertions(+), 5 deletions(-) Look good to me. Thank you. Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com> Best regards, Dariusz Sosnowski ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 08/10] pdcp: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (6 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 07/10] net/mlx5: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 09/10] net/cpfl: " Stephen Hemminger ` (2 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Anoob Joseph, Volodymyr Fialko 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> --- lib/pdcp/pdcp_entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h index 4fc6342a5ced..f854192e98dc 100644 --- a/lib/pdcp/pdcp_entity.h +++ b/lib/pdcp/pdcp_entity.h @@ -185,7 +185,7 @@ struct entity_priv_dl_part { /** Reorder packet buffer */ struct pdcp_reorder reorder; /** Bitmap memory region */ - uint8_t bitmap_mem[0]; + uint8_t bitmap_mem[]; }; struct entity_priv_ul_part { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 09/10] net/cpfl: replace zero length array with flex array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (7 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 08/10] pdcp: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 10/10] common/dpaxx: remove zero length array Stephen Hemminger 2023-11-21 7:26 ` [PATCH v4 00/10] Replace zero length arrays Morten Brørup 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Yuying Zhang, Beilei Xing 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/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c index 8a4e1419b4db..39a281fa61ee 100644 --- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c +++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c @@ -53,7 +53,7 @@ struct cpfl_rule_info_meta { uint32_t pr_num; /* number of pattern rules */ uint32_t mr_num; /* number of modification rules */ uint32_t rule_num; /* number of all rules */ - struct cpfl_rule_info rules[0]; + struct cpfl_rule_info rules[]; }; static uint32_t cpfl_fxp_mod_idx_alloc(struct cpfl_adapter_ext *ad); -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (8 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 09/10] net/cpfl: " Stephen Hemminger @ 2023-11-20 17:07 ` Stephen Hemminger 2023-11-21 10:49 ` Hemant Agrawal 2023-11-21 7:26 ` [PATCH v4 00/10] Replace zero length arrays Morten Brørup 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-20 17:07 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena There is a place holder zero length array in this driver. But since the structure is embedded in other structures, it could not have been safely used anyway. There doesn't appear to be any uses of it in the current code. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/dpaax/caamflib/desc/ipsec.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h index 95fc3ea5ba3b..9d59b93292f9 100644 --- a/drivers/common/dpaax/caamflib/desc/ipsec.h +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h @@ -336,7 +336,6 @@ struct ipsec_encap_gcm { * @ip_hdr_len: optional IP Header length (in bytes) * reserved - 16b * Opt. IP Hdr Len - 16b - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) */ struct ipsec_encap_pdb { uint32_t options; @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { }; uint32_t spi; uint32_t ip_hdr_len; - uint8_t ip_hdr[0]; }; static inline unsigned int @@ -776,7 +774,7 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool ps, bool swap, PROGRAM_SET_36BIT_ADDR(p); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + SET_LABEL(p, hdr); pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); if (authdata->keylen) @@ -913,7 +911,7 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t *descbuf, PROGRAM_CNTXT_INIT(p, descbuf, 0); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + SET_LABEL(p, hdr); pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF); /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-20 17:07 ` [PATCH v4 10/10] common/dpaxx: remove zero length array Stephen Hemminger @ 2023-11-21 10:49 ` Hemant Agrawal 2023-11-21 16:46 ` Stephen Hemminger 0 siblings, 1 reply; 84+ messages in thread From: Hemant Agrawal @ 2023-11-21 10:49 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Sachin Saxena, Gagandeep Singh > There is a place holder zero length array in this driver. > But since the structure is embedded in other structures, > it could not have been safely used anyway. > There doesn't appear to be any uses of it in the current code. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > drivers/common/dpaax/caamflib/desc/ipsec.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h > b/drivers/common/dpaax/caamflib/desc/ipsec.h > index 95fc3ea5ba3b..9d59b93292f9 100644 > --- a/drivers/common/dpaax/caamflib/desc/ipsec.h > +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h > @@ -336,7 +336,6 @@ struct ipsec_encap_gcm { > * @ip_hdr_len: optional IP Header length (in bytes) > * reserved - 16b > * Opt. IP Hdr Len - 16b > - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) > */ > struct ipsec_encap_pdb { > uint32_t options; > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > }; > uint32_t spi; > uint32_t ip_hdr_len; > - uint8_t ip_hdr[0]; [Hemant] This should be replaced with uint8_t ip_hdr[]; > }; > > static inline unsigned int > @@ -776,7 +774,7 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool ps, > bool swap, > PROGRAM_SET_36BIT_ADDR(p); > phdr = SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + [Hemant] Don't remove it. It will break the code. > SET_LABEL(p, hdr); > pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); > if (authdata->keylen) > @@ -913,7 +911,7 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t > *descbuf, > PROGRAM_CNTXT_INIT(p, descbuf, 0); > phdr = SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + [Hemant] Don't remove it > SET_LABEL(p, hdr); > pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | > SELF); > /* > -- > 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-21 10:49 ` Hemant Agrawal @ 2023-11-21 16:46 ` Stephen Hemminger 2023-11-21 17:01 ` Stephen Hemminger 2023-11-21 17:18 ` Tyler Retzlaff 0 siblings, 2 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-21 16:46 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, Sachin Saxena, Gagandeep Singh On Tue, 21 Nov 2023 10:49:59 +0000 Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > struct ipsec_encap_pdb { > > uint32_t options; > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > > }; > > uint32_t spi; > > uint32_t ip_hdr_len; > > - uint8_t ip_hdr[0]; > [Hemant] This should be replaced with > uint8_t ip_hdr[]; > > }; > > That won't work because the structure is embedded in another struct and then clang will correctly report an error. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-21 16:46 ` Stephen Hemminger @ 2023-11-21 17:01 ` Stephen Hemminger 2023-11-21 17:18 ` Tyler Retzlaff 1 sibling, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-21 17:01 UTC (permalink / raw) To: Hemant Agrawal; +Cc: dev, Sachin Saxena, Gagandeep Singh On Tue, 21 Nov 2023 08:46:41 -0800 Stephen Hemminger <stephen@networkplumber.org> wrote: > On Tue, 21 Nov 2023 10:49:59 +0000 > Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > > > struct ipsec_encap_pdb { > > > uint32_t options; > > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > > > }; > > > uint32_t spi; > > > uint32_t ip_hdr_len; > > > - uint8_t ip_hdr[0]; > > [Hemant] This should be replaced with > > uint8_t ip_hdr[]; > > > }; > > > > > That won't work because the structure is embedded in > another struct and then clang will correctly report an error. [2155/2868] Compiling C object drivers..._jr.a.p/crypto_caam_jr_caam_jr_uio.c.o In file included from ../drivers/crypto/caam_jr/caam_jr_uio.c:23: ../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct ipsec_encap_pdb encap_pdb; ^ 1 warning generated. [2160/2868] Compiling C object drivers...m_jr.a.p/crypto_caam_jr_caam_jr_hw.c.o In file included from ../drivers/crypto/caam_jr/caam_jr_hw.c:16: ../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct ipsec_encap_pdb encap_pdb; ^ 1 warning generated. [2174/2868] Compiling C object drivers....p/crypto_dpaa_sec_dpaa_sec_raw_dp.c.o In file included from ../drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c:17: ../drivers/crypto/dpaa_sec/dpaa_sec.h:190:27: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct ipsec_encap_pdb encap_pdb; ^ 1 warning generated. [2176/2868] Compiling C object drivers...caam_jr.a.p/crypto_caam_jr_caam_jr.c.o In file included from ../drivers/crypto/caam_jr/caam_jr.c:23: ../drivers/crypto/caam_jr/caam_jr_pvt.h:139:25: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct ipsec_encap_pdb encap_pdb; ^ 1 warning generated. [2246/2868] Compiling C object drivers...a_sec.a.p/crypto_dpaa_sec_dpaa_sec.c.o In file included from ../drivers/crypto/dpaa_sec/dpaa_sec.c:43: ../drivers/crypto/dpaa_sec/dpaa_sec.h:190:27: warning: field 'encap_pdb' with variable sized type 'struct ipsec_encap_pdb' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] struct ipsec_encap_pdb encap_pdb; ^ 1 warning generated. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-21 16:46 ` Stephen Hemminger 2023-11-21 17:01 ` Stephen Hemminger @ 2023-11-21 17:18 ` Tyler Retzlaff 2023-11-22 7:23 ` Hemant Agrawal 1 sibling, 1 reply; 84+ messages in thread From: Tyler Retzlaff @ 2023-11-21 17:18 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Hemant Agrawal, dev, Sachin Saxena, Gagandeep Singh On Tue, Nov 21, 2023 at 08:46:41AM -0800, Stephen Hemminger wrote: > On Tue, 21 Nov 2023 10:49:59 +0000 > Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > > > struct ipsec_encap_pdb { > > > uint32_t options; > > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > > > }; > > > uint32_t spi; > > > uint32_t ip_hdr_len; > > > - uint8_t ip_hdr[0]; > > [Hemant] This should be replaced with > > uint8_t ip_hdr[]; > > > }; > > > > > That won't work because the structure is embedded in > another struct and then clang will correctly report an error. Hemant if the field is not referenced what's the harm in removing it? ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-21 17:18 ` Tyler Retzlaff @ 2023-11-22 7:23 ` Hemant Agrawal 2023-11-23 1:43 ` Stephen Hemminger 2023-11-23 19:18 ` Stephen Hemminger 0 siblings, 2 replies; 84+ messages in thread From: Hemant Agrawal @ 2023-11-22 7:23 UTC (permalink / raw) To: Tyler Retzlaff, Stephen Hemminger; +Cc: dev, Sachin Saxena, Gagandeep Singh > -----Original Message----- > From: Tyler Retzlaff <roretzla@linux.microsoft.com> > Sent: Tuesday, November 21, 2023 10:49 PM > To: Stephen Hemminger <stephen@networkplumber.org> > Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org; Sachin > Saxena <sachin.saxena@nxp.com>; Gagandeep Singh <G.Singh@nxp.com> > Subject: Re: [PATCH v4 10/10] common/dpaxx: remove zero length array > Importance: High > > On Tue, Nov 21, 2023 at 08:46:41AM -0800, Stephen Hemminger wrote: > > On Tue, 21 Nov 2023 10:49:59 +0000 > > Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > > > > > struct ipsec_encap_pdb { > > > > uint32_t options; > > > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > > > > }; > > > > uint32_t spi; > > > > uint32_t ip_hdr_len; > > > > - uint8_t ip_hdr[0]; > > > [Hemant] This should be replaced with > > > uint8_t ip_hdr[]; > > > > }; > > > > > > > > That won't work because the structure is embedded in another struct > > and then clang will correctly report an error. > > Hemant if the field is not referenced what's the harm in removing it? It is being used indirectly, e.g. dpaa_sec.h usages it for ip address description preparation for the hardware. struct ipsec_encap_pdb encap_pdb; union { struct ip ip4_hdr; struct rte_ipv6_hdr ip6_hdr; }; We need to change it, however in the interim, I will like to add "-Wno-gnu-variable-sized-type-not-at-end" for both caam_jr and dpaa_sec to avoid this warning. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-22 7:23 ` Hemant Agrawal @ 2023-11-23 1:43 ` Stephen Hemminger 2023-11-23 19:18 ` Stephen Hemminger 1 sibling, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-23 1:43 UTC (permalink / raw) To: Hemant Agrawal; +Cc: Tyler Retzlaff, dev, Sachin Saxena, Gagandeep Singh On Wed, 22 Nov 2023 07:23:36 +0000 Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > -----Original Message----- > > From: Tyler Retzlaff <roretzla@linux.microsoft.com> > > Sent: Tuesday, November 21, 2023 10:49 PM > > To: Stephen Hemminger <stephen@networkplumber.org> > > Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org; Sachin > > Saxena <sachin.saxena@nxp.com>; Gagandeep Singh <G.Singh@nxp.com> > > Subject: Re: [PATCH v4 10/10] common/dpaxx: remove zero length array > > Importance: High > > > > On Tue, Nov 21, 2023 at 08:46:41AM -0800, Stephen Hemminger wrote: > > > On Tue, 21 Nov 2023 10:49:59 +0000 > > > Hemant Agrawal <hemant.agrawal@nxp.com> wrote: > > > > > > > > struct ipsec_encap_pdb { > > > > > uint32_t options; > > > > > @@ -350,7 +349,6 @@ struct ipsec_encap_pdb { > > > > > }; > > > > > uint32_t spi; > > > > > uint32_t ip_hdr_len; > > > > > - uint8_t ip_hdr[0]; > > > > [Hemant] This should be replaced with > > > > uint8_t ip_hdr[]; > > > > > }; > > > > > > > > > > > That won't work because the structure is embedded in another struct > > > and then clang will correctly report an error. > > > > Hemant if the field is not referenced what's the harm in removing it? > > It is being used indirectly, e.g. dpaa_sec.h usages it for ip address description preparation for the hardware. > > struct ipsec_encap_pdb encap_pdb; > union { > struct ip ip4_hdr; > struct rte_ipv6_hdr ip6_hdr; > }; > > We need to change it, however in the interim, I will like to add "-Wno-gnu-variable-sized-type-not-at-end" for both caam_jr and dpaa_sec to avoid this warning. Ok, there are several ways to fix that. Driver specific compiler flags are the one that is least favored. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-22 7:23 ` Hemant Agrawal 2023-11-23 1:43 ` Stephen Hemminger @ 2023-11-23 19:18 ` Stephen Hemminger 2023-11-28 6:43 ` Hemant Agrawal 1 sibling, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-23 19:18 UTC (permalink / raw) To: Hemant Agrawal; +Cc: Tyler Retzlaff, dev, Sachin Saxena, Gagandeep Singh This is a better alternative. From 52c805b9526dbef62377276c4499c997fbc96268 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger <stephen@networkplumber.org> Date: Thu, 23 Nov 2023 11:12:02 -0800 Subject: [PATCH] common/dpaxx: replace zero length array The zero length ip_header is used as an overlay to the encap IP header. Since the code is already assuming the layout of the structure, replace the array with direct access. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h index 95fc3ea5ba3b..d1411cc6aab4 100644 --- a/drivers/common/dpaax/caamflib/desc/ipsec.h +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h @@ -334,9 +334,7 @@ struct ipsec_encap_gcm { * @seq_num: IPsec sequence number * @spi: IPsec SPI (Security Parameters Index) * @ip_hdr_len: optional IP Header length (in bytes) - * reserved - 16b - * Opt. IP Hdr Len - 16b - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) + * Ip header must follow directly after ipsec_encap_pdb */ struct ipsec_encap_pdb { uint32_t options; @@ -350,7 +348,6 @@ struct ipsec_encap_pdb { }; uint32_t spi; uint32_t ip_hdr_len; - uint8_t ip_hdr[0]; }; static inline unsigned int @@ -776,7 +773,12 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool ps, bool swap, PROGRAM_SET_36BIT_ADDR(p); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + + /* ip header if any follows the encap_pdb */ + if (pdb->ip_hdr_len > 0) { + void *ip_hdr = pdb + 1; + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); + } SET_LABEL(p, hdr); pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); if (authdata->keylen) @@ -913,7 +915,13 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t *descbuf, PROGRAM_CNTXT_INIT(p, descbuf, 0); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + + /* ip header if any follows the encap_pdb */ + if (pdb->ip_hdr_len > 0) { + void *ip_hdr = pdb + 1; + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); + } + SET_LABEL(p, hdr); pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF); /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 10/10] common/dpaxx: remove zero length array 2023-11-23 19:18 ` Stephen Hemminger @ 2023-11-28 6:43 ` Hemant Agrawal 0 siblings, 0 replies; 84+ messages in thread From: Hemant Agrawal @ 2023-11-28 6:43 UTC (permalink / raw) To: Stephen Hemminger; +Cc: Tyler Retzlaff, dev, Sachin Saxena, Gagandeep Singh Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Friday, November 24, 2023 12:49 AM > To: Hemant Agrawal <hemant.agrawal@nxp.com> > Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>; dev@dpdk.org; Sachin > Saxena <sachin.saxena@nxp.com>; Gagandeep Singh <G.Singh@nxp.com> > Subject: Re: [PATCH v4 10/10] common/dpaxx: remove zero length array > Importance: High > > This is a better alternative. > > From 52c805b9526dbef62377276c4499c997fbc96268 Mon Sep 17 00:00:00 > 2001 > From: Stephen Hemminger <stephen@networkplumber.org> > Date: Thu, 23 Nov 2023 11:12:02 -0800 > Subject: [PATCH] common/dpaxx: replace zero length array > > The zero length ip_header is used as an overlay to the encap IP header. Since > the code is already assuming the layout of the structure, replace the array > with direct access. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h > b/drivers/common/dpaax/caamflib/desc/ipsec.h > index 95fc3ea5ba3b..d1411cc6aab4 100644 > --- a/drivers/common/dpaax/caamflib/desc/ipsec.h > +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h > @@ -334,9 +334,7 @@ struct ipsec_encap_gcm { > * @seq_num: IPsec sequence number > * @spi: IPsec SPI (Security Parameters Index) > * @ip_hdr_len: optional IP Header length (in bytes) > - * reserved - 16b > - * Opt. IP Hdr Len - 16b > - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) > + * Ip header must follow directly after ipsec_encap_pdb > */ > struct ipsec_encap_pdb { > uint32_t options; > @@ -350,7 +348,6 @@ struct ipsec_encap_pdb { > }; > uint32_t spi; > uint32_t ip_hdr_len; > - uint8_t ip_hdr[0]; > }; > > static inline unsigned int > @@ -776,7 +773,12 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool > ps, bool swap, > PROGRAM_SET_36BIT_ADDR(p); > phdr = SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + > + /* ip header if any follows the encap_pdb */ > + if (pdb->ip_hdr_len > 0) { > + void *ip_hdr = pdb + 1; > + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); > + } > SET_LABEL(p, hdr); > pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); > if (authdata->keylen) > @@ -913,7 +915,13 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t > *descbuf, > PROGRAM_CNTXT_INIT(p, descbuf, 0); > phdr = SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + > + /* ip header if any follows the encap_pdb */ > + if (pdb->ip_hdr_len > 0) { > + void *ip_hdr = pdb + 1; > + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); > + } > + > SET_LABEL(p, hdr); > pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | > SELF); > /* > -- > 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v4 00/10] Replace zero length arrays 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger ` (9 preceding siblings ...) 2023-11-20 17:07 ` [PATCH v4 10/10] common/dpaxx: remove zero length array Stephen Hemminger @ 2023-11-21 7:26 ` Morten Brørup 2023-11-21 8:30 ` fengchengwen 10 siblings, 1 reply; 84+ messages in thread From: Morten Brørup @ 2023-11-21 7:26 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Monday, 20 November 2023 18.07 > > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci > > v4 - fix issues reported by clang where zero length > array was embedded in security structures in cn10k > and txq being embedded in mlx5 was missing extension Thanks for cleaning this up. Series-acked-by: Morten Brørup <mb@smartsharesystems.com> ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v4 00/10] Replace zero length arrays 2023-11-21 7:26 ` [PATCH v4 00/10] Replace zero length arrays Morten Brørup @ 2023-11-21 8:30 ` fengchengwen 0 siblings, 0 replies; 84+ messages in thread From: fengchengwen @ 2023-11-21 8:30 UTC (permalink / raw) To: Morten Brørup, Stephen Hemminger; +Cc: dev Series-acked-by: Chengwen Feng <fengchengwen@huawei.com> On 2023/11/21 15:26, Morten Brørup wrote: >> From: Stephen Hemminger [mailto:stephen@networkplumber.org] >> Sent: Monday, 20 November 2023 18.07 >> >> Zero length arrays are a GNU extension that has been >> superseded by flex arrays. >> >> https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html >> >> These are places found by cocci/zero_length_array.cocci >> >> v4 - fix issues reported by clang where zero length >> array was embedded in security structures in cn10k >> and txq being embedded in mlx5 was missing extension > > Thanks for cleaning this up. > > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> > ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 00/10] Replace zero length arrays 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger ` (9 preceding siblings ...) 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 01/10] member: replace zero length array with flex array Stephen Hemminger ` (10 more replies) 10 siblings, 11 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Zero length arrays are a GNU extension that has been superseded by flex arrays. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html These are places found by cocci/zero_length_array.cocci v5 - revised version of dpaxx ip_hdr fix rebase to 23.11 Stephen Hemminger (10): member: replace zero length array with flex array cryptodev: replace zero length array with flex array security: replace zero length array with flex array pipeline: replace zero length array with flex array net/nfp: replace zero length array with flex array net/enic: replace zero length array with flex array net/mlx5: replace zero length array with flex array pdcp: replace zero length array with flex array net/cpfl: replace zero length array with flex array common/dpaxx: replace zero length array drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/crypto/cnxk/cn10k_ipsec.h | 4 +++- drivers/crypto/cnxk/cn9k_ipsec.h | 4 +++- drivers/crypto/cnxk/cnxk_se.h | 5 ++++- drivers/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 3 ++- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- lib/cryptodev/cryptodev_pmd.h | 2 +- lib/member/rte_member_heap.h | 2 +- lib/pdcp/pdcp_entity.h | 2 +- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- lib/security/rte_security_driver.h | 2 +- 16 files changed, 38 insertions(+), 22 deletions(-) -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 01/10] member: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 02/10] cryptodev: " Stephen Hemminger ` (9 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Yipeng Wang, Sameh Gobriel 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> --- lib/member/rte_member_heap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/member/rte_member_heap.h b/lib/member/rte_member_heap.h index 9c4a01aebe95..ab6319bc2de4 100644 --- a/lib/member/rte_member_heap.h +++ b/lib/member/rte_member_heap.h @@ -26,7 +26,7 @@ struct hash { uint16_t bkt_cnt; uint16_t num_item; uint32_t seed; - struct hash_bkt buckets[0]; + struct hash_bkt buckets[]; }; struct node { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 02/10] cryptodev: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 01/10] member: replace zero length array with flex array Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 03/10] security: " Stephen Hemminger ` (8 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Anoob Joseph, Ankur Dwivedi, Tejasree Kondoj, Akhil Goyal, Fan Zhang 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/cnxk_se.h | 5 ++++- lib/cryptodev/cryptodev_pmd.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 03/10] security: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 02/10] cryptodev: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 04/10] pipeline: " Stephen Hemminger ` (7 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Anoob Joseph, Ankur Dwivedi, Tejasree Kondoj, Akhil Goyal 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(-) 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) */ }; -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 04/10] pipeline: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (2 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 03/10] security: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 05/10] net/nfp: " Stephen Hemminger ` (6 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Cristian Dumitrescu 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> --- lib/pipeline/rte_swx_pipeline_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h index a67b6e965de7..8ec12263b989 100644 --- a/lib/pipeline/rte_swx_pipeline_internal.h +++ b/lib/pipeline/rte_swx_pipeline_internal.h @@ -213,7 +213,7 @@ TAILQ_HEAD(rss_tailq, rss); struct rss_runtime { uint32_t key_size; /* key size in bytes. */ - uint8_t key[0]; /* key. */ + uint8_t key[]; /* key. */ }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 05/10] net/nfp: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (3 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 04/10] pipeline: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-30 1:21 ` Chaoyong He 2023-11-29 2:39 ` [PATCH v5 06/10] net/enic: " Stephen Hemminger ` (5 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Niklas Söderlund, Tyler Retzlaff, Chaoyong He Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Chaoyong He <chaoyong.he@corigine.com> --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index c2938fb6f63c..f00d2e838d8f 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { uint8_t info; uint8_t nbi_port; uint8_t phys_port; - } ports[0]; + } ports[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v5 05/10] net/nfp: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 05/10] net/nfp: " Stephen Hemminger @ 2023-11-30 1:21 ` Chaoyong He 0 siblings, 0 replies; 84+ messages in thread From: Chaoyong He @ 2023-11-30 1:21 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Tyler Retzlaff Looks good to me, thanks. Acked-by: Chaoyong He <chaoyong.he@corigine.com> > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Wednesday, November 29, 2023 10:39 AM > To: dev@dpdk.org > Cc: Stephen Hemminger <stephen@networkplumber.org>; Niklas Söderlund > <niklas.soderlund@corigine.com>; Tyler Retzlaff > <roretzla@linux.microsoft.com>; Chaoyong He <chaoyong.he@corigine.com> > Subject: [PATCH v5 05/10] net/nfp: replace zero length array with flex array > > Zero length arrays are GNU extension. Replace with standard flex array. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > Acked-by: Niklas Söderlund <niklas.soderlund@corigine.com> > Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > Acked-by: Chaoyong He <chaoyong.he@corigine.com> > --- > drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h > b/drivers/net/nfp/flower/nfp_flower_cmsg.h > index c2938fb6f63c..f00d2e838d8f 100644 > --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h > +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h > @@ -73,7 +73,7 @@ struct nfp_flower_cmsg_mac_repr { > uint8_t info; > uint8_t nbi_port; > uint8_t phys_port; > - } ports[0]; > + } ports[]; > }; > > /* > -- > 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 06/10] net/enic: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (4 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 05/10] net/nfp: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 07/10] net/mlx5: " Stephen Hemminger ` (4 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, John Daley, Tyler Retzlaff, Hyong Youb Kim Zero length arrays are GNU extension. Replace with standard flex array. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: John Daley <johndale@cisco.com> Reviewed-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- drivers/net/enic/base/vnic_devcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h index 253a791c3f65..f91cc3078d63 100644 --- a/drivers/net/enic/base/vnic_devcmd.h +++ b/drivers/net/enic/base/vnic_devcmd.h @@ -765,7 +765,7 @@ struct vnic_devcmd_notify { struct vnic_devcmd_provinfo { uint8_t oui[3]; uint8_t type; - uint8_t data[0]; + uint8_t data[]; }; /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 07/10] net/mlx5: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (5 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 06/10] net/enic: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2024-01-23 9:44 ` Thomas Monjalon 2023-11-29 2:39 ` [PATCH v5 08/10] pdcp: " Stephen Hemminger ` (3 subsequent siblings) 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Tyler Retzlaff, Dariusz Sosnowski, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad 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: Dariusz Sosnowski <dsosnowski@nvidia.com> --- drivers/common/mlx5/mlx5_prm.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h index 9e22dce6da13..932b89bd79d3 100644 --- a/drivers/common/mlx5/mlx5_prm.h +++ b/drivers/common/mlx5/mlx5_prm.h @@ -5181,7 +5181,7 @@ struct mlx5_ifc_flow_context_bits { u8 reserved_at_e0[0x40]; u8 encrypt_decrypt_obj_id[0x20]; u8 reserved_at_140[0x16c0]; - union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[0]; + union mlx5_ifc_dest_format_flow_counter_list_auto_bits destination[]; }; struct mlx5_ifc_set_fte_in_bits { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 263ebead7f29..f2e2e04429d1 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1314,7 +1314,7 @@ struct mlx5_aso_ct_pool { }; struct mlx5_aso_sq *sq; /* Async ASO SQ. */ struct mlx5_aso_sq *shared_sq; /* Shared ASO SQ. */ - struct mlx5_aso_ct_action actions[0]; + struct mlx5_aso_ct_action actions[]; /* CT action structures bulk. */ }; @@ -1331,7 +1331,7 @@ struct mlx5_aso_ct_pools_mng { rte_spinlock_t ct_sl; /* The ASO CT free list lock. */ rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ struct aso_ct_list free_cts; /* Free ASO CT objects list. */ - struct mlx5_aso_sq aso_sqs[0]; /* ASO queue objects. */ + struct mlx5_aso_sq aso_sqs[]; /* ASO queue objects. */ }; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 6dde9de688b9..b35079b30a6e 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1257,7 +1257,7 @@ struct rte_flow_hw { cnt_id_t cnt_id; uint32_t mtr_id; uint32_t rule_idx; - uint8_t rule[0]; /* HWS layer data struct. */ + uint8_t rule[]; /* HWS layer data struct. */ } __rte_packed; #ifdef PEDANTIC diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index e59ce37667ba..b1e8ea19a2a1 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -171,11 +171,12 @@ struct mlx5_txq_data { struct mlx5_txq_stats stats; /* TX queue counters. */ struct mlx5_txq_stats stats_reset; /* stats on last reset. */ struct mlx5_uar_data uar_data; - struct rte_mbuf *elts[0]; + struct rte_mbuf *elts[]; /* Storage for queued packets, must be the last field. */ } __rte_cache_aligned; /* TX queue control descriptor. */ +__extension__ struct mlx5_txq_ctrl { LIST_ENTRY(mlx5_txq_ctrl) next; /* Pointer to the next element. */ uint32_t refcnt; /* Reference counter. */ -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v5 07/10] net/mlx5: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 07/10] net/mlx5: " Stephen Hemminger @ 2024-01-23 9:44 ` Thomas Monjalon 2024-01-23 10:28 ` Thomas Monjalon 0 siblings, 1 reply; 84+ messages in thread From: Thomas Monjalon @ 2024-01-23 9:44 UTC (permalink / raw) To: Dariusz Sosnowski, Stephen Hemminger Cc: dev, Tyler Retzlaff, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad 29/11/2023 03:39, Stephen Hemminger: > --- a/drivers/net/mlx5/mlx5_tx.h > +++ b/drivers/net/mlx5/mlx5_tx.h > @@ -171,11 +171,12 @@ struct mlx5_txq_data { > struct mlx5_txq_stats stats; /* TX queue counters. */ > struct mlx5_txq_stats stats_reset; /* stats on last reset. */ > struct mlx5_uar_data uar_data; > - struct rte_mbuf *elts[0]; > + struct rte_mbuf *elts[]; > /* Storage for queued packets, must be the last field. */ > } __rte_cache_aligned; > > /* TX queue control descriptor. */ > +__extension__ > struct mlx5_txq_ctrl { struct mlx5_txq_data is included at the end of struct mlx5_txq_ctrl I don't understand why we need to declare an extension here. ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v5 07/10] net/mlx5: replace zero length array with flex array 2024-01-23 9:44 ` Thomas Monjalon @ 2024-01-23 10:28 ` Thomas Monjalon 2024-01-23 11:18 ` Dariusz Sosnowski 0 siblings, 1 reply; 84+ messages in thread From: Thomas Monjalon @ 2024-01-23 10:28 UTC (permalink / raw) To: Dariusz Sosnowski, Stephen Hemminger Cc: dev, Tyler Retzlaff, Viacheslav Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad 23/01/2024 10:44, Thomas Monjalon: > 29/11/2023 03:39, Stephen Hemminger: > > --- a/drivers/net/mlx5/mlx5_tx.h > > +++ b/drivers/net/mlx5/mlx5_tx.h > > @@ -171,11 +171,12 @@ struct mlx5_txq_data { > > struct mlx5_txq_stats stats; /* TX queue counters. */ > > struct mlx5_txq_stats stats_reset; /* stats on last reset. */ > > struct mlx5_uar_data uar_data; > > - struct rte_mbuf *elts[0]; > > + struct rte_mbuf *elts[]; > > /* Storage for queued packets, must be the last field. */ > > } __rte_cache_aligned; > > > > /* TX queue control descriptor. */ > > +__extension__ > > struct mlx5_txq_ctrl { > > struct mlx5_txq_data is included at the end of struct mlx5_txq_ctrl > I don't understand why we need to declare an extension here. If I remove __extension__: error: invalid use of structure with flexible array member [-Werror=pedantic] Is it a problem only in pedantic mode? ^ permalink raw reply [flat|nested] 84+ messages in thread
* RE: [PATCH v5 07/10] net/mlx5: replace zero length array with flex array 2024-01-23 10:28 ` Thomas Monjalon @ 2024-01-23 11:18 ` Dariusz Sosnowski 0 siblings, 0 replies; 84+ messages in thread From: Dariusz Sosnowski @ 2024-01-23 11:18 UTC (permalink / raw) To: NBU-Contact-Thomas Monjalon (EXTERNAL), Stephen Hemminger Cc: dev, Tyler Retzlaff, Slava Ovsiienko, Ori Kam, Suanming Mou, Matan Azrad From: Thomas Monjalon <thomas@monjalon.net> Sent: Tuesday, January 23, 2024 11:28 > 23/01/2024 10:44, Thomas Monjalon: > > 29/11/2023 03:39, Stephen Hemminger: > > > --- a/drivers/net/mlx5/mlx5_tx.h > > > +++ b/drivers/net/mlx5/mlx5_tx.h > > > @@ -171,11 +171,12 @@ struct mlx5_txq_data { > > > struct mlx5_txq_stats stats; /* TX queue counters. */ > > > struct mlx5_txq_stats stats_reset; /* stats on last reset. */ > > > struct mlx5_uar_data uar_data; > > > - struct rte_mbuf *elts[0]; > > > + struct rte_mbuf *elts[]; > > > /* Storage for queued packets, must be the last field. */ } > > > __rte_cache_aligned; > > > > > > /* TX queue control descriptor. */ > > > +__extension__ > > > struct mlx5_txq_ctrl { > > > > struct mlx5_txq_data is included at the end of struct mlx5_txq_ctrl I > > don't understand why we need to declare an extension here. > > If I remove __extension__: > error: invalid use of structure with flexible array member [-Werror=pedantic] > > Is it a problem only in pedantic mode? Yes, because this usage is nonstandard. Using a struct which has a flexible array member, inside another struct is a compiler extension. Best regards, Dariusz Sosnowski ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 08/10] pdcp: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (6 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 07/10] net/mlx5: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 09/10] net/cpfl: " Stephen Hemminger ` (2 subsequent siblings) 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Anoob Joseph, Volodymyr Fialko 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> --- lib/pdcp/pdcp_entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h index 4fc6342a5ced..f854192e98dc 100644 --- a/lib/pdcp/pdcp_entity.h +++ b/lib/pdcp/pdcp_entity.h @@ -185,7 +185,7 @@ struct entity_priv_dl_part { /** Reorder packet buffer */ struct pdcp_reorder reorder; /** Bitmap memory region */ - uint8_t bitmap_mem[0]; + uint8_t bitmap_mem[]; }; struct entity_priv_ul_part { -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 09/10] net/cpfl: replace zero length array with flex array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (7 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 08/10] pdcp: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 10/10] common/dpaxx: replace zero length array Stephen Hemminger 2024-01-23 10:48 ` [PATCH v5 00/10] Replace zero length arrays Thomas Monjalon 10 siblings, 0 replies; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Yuying Zhang, Beilei Xing 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/net/cpfl/cpfl_flow_engine_fxp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c index 8a4e1419b4db..39a281fa61ee 100644 --- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c +++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c @@ -53,7 +53,7 @@ struct cpfl_rule_info_meta { uint32_t pr_num; /* number of pattern rules */ uint32_t mr_num; /* number of modification rules */ uint32_t rule_num; /* number of all rules */ - struct cpfl_rule_info rules[0]; + struct cpfl_rule_info rules[]; }; static uint32_t cpfl_fxp_mod_idx_alloc(struct cpfl_adapter_ext *ad); -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* [PATCH v5 10/10] common/dpaxx: replace zero length array 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (8 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 09/10] net/cpfl: " Stephen Hemminger @ 2023-11-29 2:39 ` Stephen Hemminger 2024-01-23 9:42 ` Thomas Monjalon 2024-01-23 10:48 ` [PATCH v5 00/10] Replace zero length arrays Thomas Monjalon 10 siblings, 1 reply; 84+ messages in thread From: Stephen Hemminger @ 2023-11-29 2:39 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena The zero length ip_header is used as an overlay to the encap IP header. Since the code is already assuming the layout of the structure, replace the array with direct access. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dpaax/caamflib/desc/ipsec.h index 95fc3ea5ba3b..d1411cc6aab4 100644 --- a/drivers/common/dpaax/caamflib/desc/ipsec.h +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h @@ -334,9 +334,7 @@ struct ipsec_encap_gcm { * @seq_num: IPsec sequence number * @spi: IPsec SPI (Security Parameters Index) * @ip_hdr_len: optional IP Header length (in bytes) - * reserved - 16b - * Opt. IP Hdr Len - 16b - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) + * Ip header must follow directly after ipsec_encap_pdb */ struct ipsec_encap_pdb { uint32_t options; @@ -350,7 +348,6 @@ struct ipsec_encap_pdb { }; uint32_t spi; uint32_t ip_hdr_len; - uint8_t ip_hdr[0]; }; static inline unsigned int @@ -776,7 +773,12 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool ps, bool swap, PROGRAM_SET_36BIT_ADDR(p); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + + /* ip header if any follows the encap_pdb */ + if (pdb->ip_hdr_len > 0) { + void *ip_hdr = pdb + 1; + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); + } SET_LABEL(p, hdr); pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); if (authdata->keylen) @@ -913,7 +915,13 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t *descbuf, PROGRAM_CNTXT_INIT(p, descbuf, 0); phdr = SHR_HDR(p, share, hdr, 0); __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); + + /* ip header if any follows the encap_pdb */ + if (pdb->ip_hdr_len > 0) { + void *ip_hdr = pdb + 1; + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); + } + SET_LABEL(p, hdr); pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF); /* -- 2.42.0 ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v5 10/10] common/dpaxx: replace zero length array 2023-11-29 2:39 ` [PATCH v5 10/10] common/dpaxx: replace zero length array Stephen Hemminger @ 2024-01-23 9:42 ` Thomas Monjalon 0 siblings, 0 replies; 84+ messages in thread From: Thomas Monjalon @ 2024-01-23 9:42 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Hemant Agrawal, Sachin Saxena 29/11/2023 03:39, Stephen Hemminger: > + * Ip header must follow directly after ipsec_encap_pdb [...] > + > + /* ip header if any follows the encap_pdb */ [...] > + /* ip header if any follows the encap_pdb */ I would change "ip" to "IP". ^ permalink raw reply [flat|nested] 84+ messages in thread
* Re: [PATCH v5 00/10] Replace zero length arrays 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger ` (9 preceding siblings ...) 2023-11-29 2:39 ` [PATCH v5 10/10] common/dpaxx: replace zero length array Stephen Hemminger @ 2024-01-23 10:48 ` Thomas Monjalon 10 siblings, 0 replies; 84+ messages in thread From: Thomas Monjalon @ 2024-01-23 10:48 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev 29/11/2023 03:39, Stephen Hemminger: > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci > > v5 - revised version of dpaxx ip_hdr fix > rebase to 23.11 > > Stephen Hemminger (10): > member: replace zero length array with flex array > cryptodev: replace zero length array with flex array > security: replace zero length array with flex array > pipeline: replace zero length array with flex array > net/nfp: replace zero length array with flex array > net/enic: replace zero length array with flex array > net/mlx5: replace zero length array with flex array > pdcp: replace zero length array with flex array > net/cpfl: replace zero length array with flex array > common/dpaxx: replace zero length array There is no more left with devtools/cocci.sh devtools/cocci/zero_length_array.cocci Applied, thanks. ^ permalink raw reply [flat|nested] 84+ messages in thread
end of thread, other threads:[~2024-01-23 11:19 UTC | newest] Thread overview: 84+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger 2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger 2023-01-14 0:19 ` Tyler Retzlaff 2023-01-14 0:36 ` Stephen Hemminger 2023-01-14 0:42 ` Tyler Retzlaff 2023-01-13 21:52 ` [PATCH 2/7] cryptodev: " Stephen Hemminger 2023-01-13 21:52 ` [PATCH 3/7] security: " Stephen Hemminger 2023-01-13 21:52 ` [PATCH 4/7] mlx5: " Stephen Hemminger 2023-01-14 17:08 ` Stephen Hemminger 2023-03-06 13:29 ` Slava Ovsiienko 2023-01-13 21:52 ` [PATCH 5/7] nfp: " Stephen Hemminger 2023-01-15 15:22 ` Niklas Söderlund 2023-01-13 21:52 ` [PATCH 6/7] enic: " Stephen Hemminger 2023-01-14 1:12 ` John Daley (johndale) 2023-01-13 21:52 ` [PATCH 7/7] dpaax: " Stephen Hemminger 2023-01-15 11:59 ` Hemant Agrawal 2023-01-14 10:43 ` [PATCH 0/7] replace zero length arrays Morten Brørup 2023-11-17 4:03 ` [PATCH v2 00/10] " Stephen Hemminger 2023-11-17 4:03 ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-17 4:17 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 02/10] cryptodev: " Stephen Hemminger 2023-11-17 4:18 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 03/10] security: " Stephen Hemminger 2023-11-17 4:18 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 04/10] pipeline: " Stephen Hemminger 2023-11-17 4:19 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 05/10] net/nfp: " Stephen Hemminger 2023-11-17 4:19 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 06/10] net/enic: " Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 07/10] net/mlx5: " Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 08/10] pdcp: " Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 5:28 ` [EXT] " Anoob Joseph 2023-11-17 4:03 ` [PATCH v2 09/10] net/cpfl: " Stephen Hemminger 2023-11-17 4:20 ` Tyler Retzlaff 2023-11-17 4:03 ` [PATCH v2 10/10] common/dpaxx: " Stephen Hemminger 2023-11-17 4:21 ` Tyler Retzlaff 2023-11-17 8:31 ` [PATCH v2 00/10] replace zero length arrays Morten Brørup 2023-11-17 16:18 ` Stephen Hemminger 2023-11-17 19:59 ` Tyler Retzlaff 2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-20 17:06 ` [PATCH v4 02/10] cryptodev: " Stephen Hemminger 2023-11-21 5:29 ` [EXT] " Anoob Joseph 2023-11-20 17:06 ` [PATCH v4 03/10] security: " Stephen Hemminger 2023-11-21 5:30 ` [EXT] " Anoob Joseph 2023-11-20 17:06 ` [PATCH v4 04/10] pipeline: " Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 05/10] net/nfp: " Stephen Hemminger 2023-11-21 1:14 ` Chaoyong He 2023-11-20 17:07 ` [PATCH v4 06/10] net/enic: " Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 07/10] net/mlx5: " Stephen Hemminger 2023-11-23 17:54 ` Dariusz Sosnowski 2023-11-20 17:07 ` [PATCH v4 08/10] pdcp: " Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 09/10] net/cpfl: " Stephen Hemminger 2023-11-20 17:07 ` [PATCH v4 10/10] common/dpaxx: remove zero length array Stephen Hemminger 2023-11-21 10:49 ` Hemant Agrawal 2023-11-21 16:46 ` Stephen Hemminger 2023-11-21 17:01 ` Stephen Hemminger 2023-11-21 17:18 ` Tyler Retzlaff 2023-11-22 7:23 ` Hemant Agrawal 2023-11-23 1:43 ` Stephen Hemminger 2023-11-23 19:18 ` Stephen Hemminger 2023-11-28 6:43 ` Hemant Agrawal 2023-11-21 7:26 ` [PATCH v4 00/10] Replace zero length arrays Morten Brørup 2023-11-21 8:30 ` fengchengwen 2023-11-29 2:39 ` [PATCH v5 " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 01/10] member: replace zero length array with flex array Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 02/10] cryptodev: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 03/10] security: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 04/10] pipeline: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 05/10] net/nfp: " Stephen Hemminger 2023-11-30 1:21 ` Chaoyong He 2023-11-29 2:39 ` [PATCH v5 06/10] net/enic: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 07/10] net/mlx5: " Stephen Hemminger 2024-01-23 9:44 ` Thomas Monjalon 2024-01-23 10:28 ` Thomas Monjalon 2024-01-23 11:18 ` Dariusz Sosnowski 2023-11-29 2:39 ` [PATCH v5 08/10] pdcp: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 09/10] net/cpfl: " Stephen Hemminger 2023-11-29 2:39 ` [PATCH v5 10/10] common/dpaxx: replace zero length array Stephen Hemminger 2024-01-23 9:42 ` Thomas Monjalon 2024-01-23 10:48 ` [PATCH v5 00/10] Replace zero length arrays Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).