public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] examples/vmdq_dcb: initialize all configuration structures
@ 2026-02-19  0:33 Stephen Hemminger
  2026-02-19  8:59 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-02-19  0:33 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, stable, Jingjing Wu, Helin Zhang

Replace field-by-field assignment of local configuration structures
with designated initializers. This ensures all fields, including
enable_loop_back and any padding, are zero-initialized.

The Coverity warning was always latent; the earlier use of
rte_memcpy() was hiding it from the analyzer.

Coverity issue: 501603
Fixes: 8cc72f2814dd ("examples/vmdq_dcb: support X710")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/vmdq_dcb/main.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 6eccee086d..d6f7b632b9 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -132,23 +132,23 @@ static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS];
 static inline int
 get_eth_conf(struct rte_eth_conf *eth_conf)
 {
-	struct rte_eth_vmdq_dcb_conf conf;
-	struct rte_eth_vmdq_rx_conf  vmdq_conf;
-	struct rte_eth_dcb_rx_conf   dcb_conf;
-	struct rte_eth_vmdq_dcb_tx_conf tx_conf;
+	struct rte_eth_vmdq_dcb_conf conf = {
+		.nb_queue_pools = (enum rte_eth_nb_pools)num_pools,
+		.nb_pool_maps = num_pools,
+	};
+	struct rte_eth_vmdq_rx_conf vmdq_conf = {
+		.nb_queue_pools = (enum rte_eth_nb_pools)num_pools,
+		.nb_pool_maps = num_pools,
+	};
+	struct rte_eth_dcb_rx_conf dcb_conf = {
+		.nb_tcs = (enum rte_eth_nb_tcs)num_tcs,
+	};
+	struct rte_eth_vmdq_dcb_tx_conf tx_conf = {
+		.nb_queue_pools = (enum rte_eth_nb_pools)num_pools,
+	};
 	uint8_t i;
 
-	conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
-	vmdq_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
-	tx_conf.nb_queue_pools = (enum rte_eth_nb_pools)num_pools;
-	conf.nb_pool_maps = num_pools;
-	vmdq_conf.nb_pool_maps = num_pools;
-	conf.enable_default_pool = 0;
-	vmdq_conf.enable_default_pool = 0;
-	conf.default_pool = 0; /* set explicit value, even if not used */
-	vmdq_conf.default_pool = 0;
-
-	for (i = 0; i < conf.nb_pool_maps; i++) {
+	for (i = 0; i < num_pools; i++) {
 		conf.pool_map[i].vlan_id = vlan_tags[i];
 		vmdq_conf.pool_map[i].vlan_id = vlan_tags[i];
 		conf.pool_map[i].pools = 1UL << i;
@@ -159,7 +159,6 @@ get_eth_conf(struct rte_eth_conf *eth_conf)
 		dcb_conf.dcb_tc[i] = i % num_tcs;
 		tx_conf.dcb_tc[i] = i % num_tcs;
 	}
-	dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs;
 
 	*eth_conf = vmdq_dcb_conf_default;
 	eth_conf->rx_adv_conf.vmdq_dcb_conf = conf;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/vmdq_dcb: initialize all configuration structures
  2026-02-19  0:33 [PATCH] examples/vmdq_dcb: initialize all configuration structures Stephen Hemminger
@ 2026-02-19  8:59 ` Bruce Richardson
  2026-03-17 16:52   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2026-02-19  8:59 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, stable, Jingjing Wu, Helin Zhang

On Wed, Feb 18, 2026 at 04:33:54PM -0800, Stephen Hemminger wrote:
> Replace field-by-field assignment of local configuration structures
> with designated initializers. This ensures all fields, including
> enable_loop_back and any padding, are zero-initialized.
> 
> The Coverity warning was always latent; the earlier use of
> rte_memcpy() was hiding it from the analyzer.
> 
> Coverity issue: 501603
> Fixes: 8cc72f2814dd ("examples/vmdq_dcb: support X710")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  examples/vmdq_dcb/main.c | 31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] examples/vmdq_dcb: initialize all configuration structures
  2026-02-19  8:59 ` Bruce Richardson
@ 2026-03-17 16:52   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-03-17 16:52 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, stable, Jingjing Wu, Helin Zhang, Bruce Richardson

19/02/2026 09:59, Bruce Richardson:
> On Wed, Feb 18, 2026 at 04:33:54PM -0800, Stephen Hemminger wrote:
> > Replace field-by-field assignment of local configuration structures
> > with designated initializers. This ensures all fields, including
> > enable_loop_back and any padding, are zero-initialized.
> > 
> > The Coverity warning was always latent; the earlier use of
> > rte_memcpy() was hiding it from the analyzer.
> > 
> > Coverity issue: 501603
> > Fixes: 8cc72f2814dd ("examples/vmdq_dcb: support X710")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> >  examples/vmdq_dcb/main.c | 31 +++++++++++++++----------------
> >  1 file changed, 15 insertions(+), 16 deletions(-)
> > 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-17 16:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19  0:33 [PATCH] examples/vmdq_dcb: initialize all configuration structures Stephen Hemminger
2026-02-19  8:59 ` Bruce Richardson
2026-03-17 16:52   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox