From: "Renyong Wan" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <stephen@networkplumber.org>,
<qianr@yunsilicon.com>, <nana@yunsilicon.com>,
<zhangxx@yunsilicon.com>, <xudw@yunsilicon.com>,
<jacky@yunsilicon.com>, <weihg@yunsilicon.com>,
<zhenghy@yunsilicon.com>
Subject: [PATCH 1/2] net/xsc: fix resource leaks
Date: Fri, 18 Apr 2025 18:34:36 +0800 [thread overview]
Message-ID: <20250418103434.2489377-2-wanry@yunsilicon.com> (raw)
In-Reply-To: <20250418103434.2489377-1-wanry@yunsilicon.com>
Fixed the Coverity-detected issue that resource leaks.
Coverity issue: 457741
Fixes: 3d57851720d4 ("net/xsc: check null pointer dereference")
Signed-off-by: Rong Qian <qianr@yunsilicon.com>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
drivers/net/xsc/xsc_rx.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/xsc/xsc_rx.c b/drivers/net/xsc/xsc_rx.c
index 0100ccdcfd..65d63b94de 100644
--- a/drivers/net/xsc/xsc_rx.c
+++ b/drivers/net/xsc/xsc_rx.c
@@ -309,8 +309,11 @@ xsc_rss_qp_create(struct xsc_ethdev_priv *priv, int port_id)
for (i = 0; i < priv->num_rq; i++) {
rxq_data = xsc_rxq_get(priv, i);
- if (rxq_data == NULL)
- return -EINVAL;
+ if (rxq_data == NULL) {
+ rte_errno = EINVAL;
+ goto error;
+ }
+
req = (struct xsc_cmd_create_qp_request *)(&in->data[0] + entry_len * i);
req->input_qpn = rte_cpu_to_be_16(0); /* useless for eth */
req->pa_num = rte_cpu_to_be_16(pa_num);
@@ -350,8 +353,11 @@ xsc_rss_qp_create(struct xsc_ethdev_priv *priv, int port_id)
for (i = 0; i < priv->num_rq; i++) {
rxq_data = xsc_rxq_get(priv, i);
- if (rxq_data == NULL)
- return -EINVAL;
+ if (rxq_data == NULL) {
+ rte_errno = EINVAL;
+ goto error;
+ }
+
rxq_data->wqes = rxq_data->rq_pas->addr;
if (!xsc_dev_is_vf(xdev))
rxq_data->rq_db = (uint32_t *)((uint8_t *)xdev->bar_addr +
--
2.25.1
next prev parent reply other threads:[~2025-04-18 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 10:34 [PATCH 0/2] Optimize the code to void " Renyong Wan
2025-04-18 10:34 ` Renyong Wan [this message]
2025-04-18 10:34 ` [PATCH 2/2] net/xsc: optimize release path Renyong Wan
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=20250418103434.2489377-2-wanry@yunsilicon.com \
--to=wanry@yunsilicon.com \
--cc=dev@dpdk.org \
--cc=jacky@yunsilicon.com \
--cc=nana@yunsilicon.com \
--cc=qianr@yunsilicon.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=weihg@yunsilicon.com \
--cc=xudw@yunsilicon.com \
--cc=zhangxx@yunsilicon.com \
--cc=zhenghy@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;
as well as URLs for NNTP newsgroup(s).