DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Renyong Wan" <wanry@yunsilicon.com>
Cc: <dev@dpdk.org>, <nana@yunsilicon.com>, <qianr@yunsilicon.com>,
	<zhangxx@yunsilicon.com>, <xudw@yunsilicon.com>
Subject: Re: [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer
Date: Mon, 16 Nov 2026 10:46:52 -0800	[thread overview]
Message-ID: <20261116104652.6db701e4@phoenix.local> (raw)
In-Reply-To: <179481232343.1639.15317349483624427514@yunsilicon.com>

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.

  parent reply	other threads:[~2026-11-16 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  6:58 [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer Renyong Wan
2026-11-16  6:58 ` [PATCH v2 3/3] net/xsc: rename jumbo buffer fields Renyong Wan
2026-11-16  6:58 ` [PATCH v2 1/3] net/xsc: fix jumbo buffer allocation and leak Renyong Wan
2026-11-16  6:58 ` [PATCH v2 2/3] net/xsc: fix leak and missing null check Renyong Wan
2026-11-16 18:46 ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-11-17  6:39 [PATCH v2 0/3] net/xsc: fix issues reported by GCC analyzer WanRenyong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116104652.6db701e4@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=nana@yunsilicon.com \
    --cc=qianr@yunsilicon.com \
    --cc=wanry@yunsilicon.com \
    --cc=xudw@yunsilicon.com \
    --cc=zhangxx@yunsilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox