[PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic
Chaoyong He
chaoyong.he at corigine.com
Sat Oct 12 04:41:07 CEST 2024
Fix one memory leak problem in the logic of VF initialization.
Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data")
Cc: stable at dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/nfp/nfp_ethdev_vf.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index ab413a2c5a..0aadca9010 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -322,12 +322,13 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat",
- sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0);
+ net_hw->eth_xstats_base = rte_calloc("rte_eth_xstat",
+ nfp_net_xstats_size(eth_dev), sizeof(struct rte_eth_xstat), 0);
if (net_hw->eth_xstats_base == NULL) {
PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!",
pci_dev->device.name);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto hw_priv_free;
}
/* Work out where in the BAR the queues start. */
--
2.39.1
More information about the dev
mailing list