public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Jingjing Wu <jingjing.wu@intel.com>,
	Helin Zhang <helin.zhang@intel.com>
Subject: [PATCH] examples/vmdq_dcb: initialize all configuration structures
Date: Wed, 18 Feb 2026 16:33:54 -0800	[thread overview]
Message-ID: <20260219003354.83183-1-stephen@networkplumber.org> (raw)

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


             reply	other threads:[~2026-02-19  0:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19  0:33 Stephen Hemminger [this message]
2026-02-19  8:59 ` [PATCH] examples/vmdq_dcb: initialize all configuration structures Bruce Richardson
2026-03-17 16:52   ` Thomas Monjalon

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20260219003354.83183-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

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

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