* Re: [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer
@ 2026-11-17 6:39 WanRenyong
0 siblings, 0 replies; 3+ messages in thread
From: WanRenyong @ 2026-11-17 6:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, nana, qianr, zhangxx, xudw
[-- Attachment #1: Type: text/plain, Size: 694 bytes --]
On 2026-11-16 10:46 -0800, Stephen Hemminger wrote:
> Error: the leak is not fixed. xsc_dev_uninit() is only called from
> the probe error path in xsc_ethdev_init(), where the jumbo buffer
> can never have been allocated (rte_zmalloc'd xdev, port never
> started). The normal remove path is xsc_ethdev_uninit(), which does
> not call xsc_dev_uninit(); it frees xdev directly:
>
> ret |= xsc_ethdev_close(eth_dev);
> xsc_dev_pct_uninit(priv->xdev);
> rte_free(priv->xdev);
>
> So the buffer still leaks on every device removal.
Hi Stephen,
Thanks for the review. Noted, I will send the next version of the series
shortly.
Thanks,
Renyong
[-- Attachment #2: Type: text/html, Size: 4405 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer
@ 2026-11-16 6:58 Renyong Wan
2026-11-16 18:46 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Renyong Wan @ 2026-11-16 6:58 UTC (permalink / raw)
To: dev; +Cc: stephen, nana, qianr, zhangxx, xudw
v2 addresses the issues raised in the AI review of v1:
- allocate the jumbo buffer once per device, fail the queue setup when
there is no IOVA, and free it on device close
- fix the leak in xsc_dev_init() and the unchecked rte_malloc_socket()
- rename the jumbo buffer fields, they held the opposite of what their
names say
Renyong Wan (3):
net/xsc: fix jumbo buffer allocation and leak
net/xsc: fix leak and missing null check
net/xsc: rename jumbo buffer fields
drivers/net/xsc/xsc_dev.c | 2 ++
drivers/net/xsc/xsc_dev.h | 4 +--
drivers/net/xsc/xsc_ethdev.c | 6 ++++
drivers/net/xsc/xsc_rx.c | 53 ++++++++++++++++++++----------------
4 files changed, 39 insertions(+), 26 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer
2026-11-16 6:58 Renyong Wan
@ 2026-11-16 18:46 ` Stephen Hemminger
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2026-11-16 18:46 UTC (permalink / raw)
To: Renyong Wan; +Cc: dev, nana, qianr, zhangxx, xudw
On Mon, 16 Nov 2026 06:58:43 -0000
"Renyong Wan" <wanry@yunsilicon.com> wrote:
> v2 addresses the issues raised in the AI review of v1:
> - allocate the jumbo buffer once per device, fail the queue setup when
> there is no IOVA, and free it on device close
> - fix the leak in xsc_dev_init() and the unchecked rte_malloc_socket()
> - rename the jumbo buffer fields, they held the opposite of what their
> names say
>
> Renyong Wan (3):
> net/xsc: fix jumbo buffer allocation and leak
> net/xsc: fix leak and missing null check
> net/xsc: rename jumbo buffer fields
>
> drivers/net/xsc/xsc_dev.c | 2 ++
> drivers/net/xsc/xsc_dev.h | 4 +--
> drivers/net/xsc/xsc_ethdev.c | 6 ++++
> drivers/net/xsc/xsc_rx.c | 53 ++++++++++++++++++++----------------
> 4 files changed, 39 insertions(+), 26 deletions(-)
Still has one AI reported error.
Subject: Re: [PATCH v2 1/3] net/xsc: fix jumbo buffer allocation and leak
Series applies to main and each commit builds with -Dwerror=true.
The allocation rework in 1/3 and the rename in 3/3 look right.
Patches 2/3 and 3/3 have no findings.
[PATCH v2 1/3] net/xsc: fix jumbo buffer allocation and leak
Error: the leak is not fixed. xsc_dev_uninit() is only called from
the probe error path in xsc_ethdev_init(), where the jumbo buffer
can never have been allocated (rte_zmalloc'd xdev, port never
started). The normal remove path is xsc_ethdev_uninit(), which does
not call xsc_dev_uninit(); it frees xdev directly:
ret |= xsc_ethdev_close(eth_dev);
xsc_dev_pct_uninit(priv->xdev);
rte_free(priv->xdev);
So the buffer still leaks on every device removal. Free it there as
well (with 3/3 applied, jumbo_buf):
ret |= xsc_ethdev_close(eth_dev);
xsc_dev_pct_uninit(priv->xdev);
rte_free(priv->xdev->jumbo_buffer_pa);
rte_free(priv->xdev);
Calling xsc_dev_uninit() from xsc_ethdev_uninit() instead would run
xsc_dev_close() a second time, so the direct free is the simpler
fix. Keeping the rte_free() in xsc_dev_uninit() is harmless.
Update the commit message accordingly; "free it in xsc_dev_uninit()"
describes the path that does not run on close or removal.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-17 6:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 6:39 [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer WanRenyong
-- strict thread matches above, loose matches on Subject: below --
2026-11-16 6:58 Renyong Wan
2026-11-16 18:46 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.