Skip to content

Commit

Permalink
netif: fix memory corruption problem when retrieving nic's xstats
Browse files Browse the repository at this point in the history
Signed-off-by: ywc689 <[email protected]>
  • Loading branch information
ywc689 committed Sep 19, 2024
1 parent 663466d commit 9cfa464
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,7 @@ static int netif_op_get_xstats(struct netif_port *dev, netif_nic_xstats_get_t **
if (nentries < 0)
return EDPVS_DPDKAPIFAIL;

get = rte_calloc("xstats_get", 1, nentries * sizeof(struct netif_nic_xstats_entry), 0);
get = rte_calloc("xstats_get", 1, sizeof(*get) + nentries * sizeof(struct netif_nic_xstats_entry), 0);
if (unlikely(!get))
return EDPVS_NOMEM;
xstats = rte_calloc("xstats", 1, nentries * sizeof(struct rte_eth_xstat), 0);
Expand Down

0 comments on commit 9cfa464

Please sign in to comment.