[PATCH 1/4] examples/vhost: replace memcpy with assignment

Stephen Hemminger stephen at networkplumber.org
Wed Jan 21 18:04:54 CET 2026


Better to use structure assignment to preserve type info.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 examples/vhost/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 4391d88c3d..ac888348d2 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -405,9 +405,8 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_devices)
 		conf.pool_map[i].pools = (1UL << i);
 	}
 
-	(void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf,
-		   sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+	*eth_conf = vmdq_conf_default;
+	eth_conf->rx_adv_conf.vmdq_rx_conf = conf;
 	return 0;
 }
 
-- 
2.51.0



More information about the dev mailing list