> The code to cleanup in case of error was passing incorrect > value to rte_free. The ports[] entry was allocated with > rte_malloc and that should be used instead of the offset > in that object. > > Fixes: 97a05c1fe634 ("event/cnxk: add port config") > Cc: sthot...@marvell.com > Cc: sta...@dpdk.org > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org> > --- > drivers/event/cnxk/cnxk_eventdev.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/event/cnxk/cnxk_eventdev.c > b/drivers/event/cnxk/cnxk_eventdev.c > index 4b2d6bffa6..08c6ce0c07 100644 > --- a/drivers/event/cnxk/cnxk_eventdev.c > +++ b/drivers/event/cnxk/cnxk_eventdev.c > @@ -121,8 +121,10 @@ cnxk_setup_event_ports(const struct rte_eventdev > *event_dev, > return 0; > hws_fini: > for (i = i - 1; i >= 0; i--) { > + void *ws = event_dev->data->ports[i]; > + > event_dev->data->ports[i] = NULL; > - rte_free(cnxk_sso_hws_get_cookie(event_dev->data- > >ports[i])); > + rte_free(ws);
Hi Stephen, The rte_zmalloc memory is pointing to the cookie[1], the memory assigned to event_dev->data->ports[i] is rte_zmalloc + RTE_CACHE_LINE_SIZE. There is still a bug in the code where we are assigning NULL before freeing memory. The fix should be rte_free(cnxk_sso_hws_get_cookie(event_dev->data->ports[i])); event_dev->data->ports[i] = NULL; [1] /* Allocate event port memory */ ws = rte_zmalloc("cn10k_ws", sizeof(struct cn10k_sso_hws) + RTE_CACHE_LINE_SIZE, RTE_CACHE_LINE_SIZE); /* First cache line is reserved for cookie */ ws = (struct cn10k_sso_hws *)((uint8_t *)ws + RTE_CACHE_LINE_SIZE); Thanks, Pavan. > } > return -ENOMEM; > } > -- > 2.45.2