[PATCH 2/3] ethdev: fix memory leak when telemetry xstats
Bruce Richardson
bruce.richardson at intel.com
Thu Apr 21 11:03:58 CEST 2022
On Thu, Apr 21, 2022 at 10:09:56AM +0200, David Marchand wrote:
> On Sat, Apr 16, 2022 at 3:14 AM Chengwen Feng <fengchengwen at huawei.com> wrote:
> >
> > The 'eth_xstats' should be freed after setup telemetry dictionary. This
> > patch fixes it.
> >
> > Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks")
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> > ---
> > lib/ethdev/rte_ethdev.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> > index 615383bde2..df20433c2d 100644
> > --- a/lib/ethdev/rte_ethdev.c
> > +++ b/lib/ethdev/rte_ethdev.c
> > @@ -5585,6 +5585,7 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused,
> > for (i = 0; i < num_xstats; i++)
> > rte_tel_data_add_dict_u64(d, xstat_names[i].name,
> > eth_xstats[i].value);
> > + free(eth_xstats);
> > return 0;
> > }
> >
>
> We need some minimal testing for telemetry commands.
>
> It could be a test automatically calling all available /ethdev/
> commands on a running testpmd.
> This test could be really simple, not even checking what is returned.
> It would just try every command sequentially with no parameter first,
> then with port 0 and finally with port 1.
>
That seems reasonable. However, I'd go a little further and have all
available commands called as an initial sanity check. Then we can use some
heuristics to go further, with the *dev/stats commands or xstats commands
all being called with numeric parameters as you suggest.
/Bruce
More information about the dev
mailing list