From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>, <david.marchand@redhat.com>
Cc: <jerry.lilijun@huawei.com>, <xudingke@huawei.com>,
Yunjian Wang <wangyunjian@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v2] bus/fslmc: fix memory leak in secondary process
Date: Fri, 17 Jul 2020 18:50:17 +0800 [thread overview]
Message-ID: <1594983017-21936-1-git-send-email-wangyunjian@huawei.com> (raw)
In-Reply-To: <c953585f981d443a42b24e284a48eed8a8450009.1594270224.git.wangyunjian@huawei.com>
From: Yunjian Wang <wangyunjian@huawei.com>
In fslmc_process_mcp(), we allocate memory for 'dev_name' but not
released before return in secondary process. And it is not used
since commit a69f79300262 ("bus/fslmc: support multi VFIO group"),
so it can be removed.
Fixes: e55d0494ab98 ("bus/fslmc: support secondary process")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
v2:
* Remove unused dev_name suggested by David Marchand
---
drivers/bus/fslmc/fslmc_vfio.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index efe2c43d3..9134ec552 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -739,7 +739,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
{
int ret;
intptr_t v_addr;
- char *dev_name = NULL;
struct fsl_mc_io dpmng = {0};
struct mc_version mc_ver_info = {0};
@@ -750,13 +749,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
goto cleanup;
}
- dev_name = strdup(dev->device.name);
- if (!dev_name) {
- DPAA2_BUS_ERR("Unable to allocate MC device name memory");
- ret = -ENOMEM;
- goto cleanup;
- }
-
v_addr = vfio_map_mcp_obj(dev->device.name);
if (v_addr == (intptr_t)MAP_FAILED) {
DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno);
@@ -793,13 +785,9 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
}
rte_mcp_ptr_list[MC_PORTAL_INDEX] = (void *)v_addr;
- free(dev_name);
return 0;
cleanup:
- if (dev_name)
- free(dev_name);
-
if (rte_mcp_ptr_list) {
free(rte_mcp_ptr_list);
rte_mcp_ptr_list = NULL;
--
2.23.0
next prev parent reply other threads:[~2020-07-17 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 10:39 [dpdk-dev] [PATCH 1/1] " wangyunjian
2020-07-09 15:15 ` Hemant Agrawal
2020-07-17 9:20 ` David Marchand
2020-07-17 9:36 ` wangyunjian
2020-07-17 10:50 ` wangyunjian [this message]
2020-07-20 5:28 ` [dpdk-dev] [PATCH v2] " Hemant Agrawal (OSS)
2020-07-21 18:52 ` David Marchand
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=1594983017-21936-1-git-send-email-wangyunjian@huawei.com \
--to=wangyunjian@huawei.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jerry.lilijun@huawei.com \
--cc=stable@dpdk.org \
--cc=xudingke@huawei.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).