* [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process
@ 2020-07-09 10:39 wangyunjian
2020-07-09 15:15 ` Hemant Agrawal
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: wangyunjian @ 2020-07-09 10:39 UTC (permalink / raw)
To: dev
Cc: hemant.agrawal, sachin.saxena, jerry.lilijun, xudingke,
Yunjian Wang, stable
From: Yunjian Wang <wangyunjian@huawei.com>
In fslmc_process_mcp(), we allocate memory for 'dev_name' but not released
before return in secondary process.
Coverity issue: 268327
Fixes: e55d0494ab98 ("bus/fslmc: support secondary process")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
drivers/bus/fslmc/fslmc_vfio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index efe2c43d3..247a265c0 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -772,6 +772,7 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
*/
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
rte_mcp_ptr_list[MC_PORTAL_INDEX] = (void *)v_addr;
+ free(dev_name);
return 0;
}
--
2.23.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process
2020-07-09 10:39 [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process wangyunjian
@ 2020-07-09 15:15 ` Hemant Agrawal
2020-07-17 9:20 ` David Marchand
2020-07-17 10:50 ` [dpdk-dev] [PATCH v2] " wangyunjian
2 siblings, 0 replies; 7+ messages in thread
From: Hemant Agrawal @ 2020-07-09 15:15 UTC (permalink / raw)
To: wangyunjian, dev; +Cc: Sachin Saxena, jerry.lilijun, xudingke, stable
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process
2020-07-09 10:39 [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process 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 ` [dpdk-dev] [PATCH v2] " wangyunjian
2 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2020-07-17 9:20 UTC (permalink / raw)
To: wangyunjian, Hemant Agrawal
Cc: dev, Sachin Saxena, Lilijun (Jerry), xudingke, dpdk stable
On Thu, Jul 9, 2020 at 12:40 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> In fslmc_process_mcp(), we allocate memory for 'dev_name' but not released
> before return in secondary process.
dev_name is not used anymore since a69f79300262 ("bus/fslmc: support
multi VFIO group")
We can remove it entirely in this function.
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process
2020-07-17 9:20 ` David Marchand
@ 2020-07-17 9:36 ` wangyunjian
0 siblings, 0 replies; 7+ messages in thread
From: wangyunjian @ 2020-07-17 9:36 UTC (permalink / raw)
To: David Marchand, Hemant Agrawal
Cc: dev, Sachin Saxena, Lilijun (Jerry), xudingke, dpdk stable
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Friday, July 17, 2020 5:21 PM
> To: wangyunjian <wangyunjian@huawei.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>
> Cc: dev <dev@dpdk.org>; Sachin Saxena <sachin.saxena@nxp.com>; Lilijun
> (Jerry) <jerry.lilijun@huawei.com>; xudingke <xudingke@huawei.com>; dpdk
> stable <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary
> process
>
> On Thu, Jul 9, 2020 at 12:40 PM wangyunjian <wangyunjian@huawei.com>
> wrote:
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > In fslmc_process_mcp(), we allocate memory for 'dev_name' but not
> > released before return in secondary process.
>
> dev_name is not used anymore since a69f79300262 ("bus/fslmc: support multi
> VFIO group") We can remove it entirely in this function.
Thanks for your suggestion, will include it in next version.
Yunjian
>
> --
> David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] bus/fslmc: fix memory leak in secondary process
2020-07-09 10:39 [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process wangyunjian
2020-07-09 15:15 ` Hemant Agrawal
2020-07-17 9:20 ` David Marchand
@ 2020-07-17 10:50 ` wangyunjian
2020-07-20 5:28 ` Hemant Agrawal (OSS)
2020-07-21 18:52 ` David Marchand
2 siblings, 2 replies; 7+ messages in thread
From: wangyunjian @ 2020-07-17 10:50 UTC (permalink / raw)
To: dev, david.marchand; +Cc: jerry.lilijun, xudingke, Yunjian Wang, stable
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] bus/fslmc: fix memory leak in secondary process
2020-07-17 10:50 ` [dpdk-dev] [PATCH v2] " wangyunjian
@ 2020-07-20 5:28 ` Hemant Agrawal (OSS)
2020-07-21 18:52 ` David Marchand
1 sibling, 0 replies; 7+ messages in thread
From: Hemant Agrawal (OSS) @ 2020-07-20 5:28 UTC (permalink / raw)
To: wangyunjian, dev, david.marchand; +Cc: jerry.lilijun, xudingke, stable
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2] bus/fslmc: fix memory leak in secondary process
2020-07-17 10:50 ` [dpdk-dev] [PATCH v2] " wangyunjian
2020-07-20 5:28 ` Hemant Agrawal (OSS)
@ 2020-07-21 18:52 ` David Marchand
1 sibling, 0 replies; 7+ messages in thread
From: David Marchand @ 2020-07-21 18:52 UTC (permalink / raw)
To: wangyunjian; +Cc: dev, Lilijun (Jerry), xudingke, dpdk stable
On Fri, Jul 17, 2020 at 12:50 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> 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>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-21 18:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 10:39 [dpdk-dev] [PATCH 1/1] bus/fslmc: fix memory leak in secondary process 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 ` [dpdk-dev] [PATCH v2] " wangyunjian
2020-07-20 5:28 ` Hemant Agrawal (OSS)
2020-07-21 18:52 ` David Marchand
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).