patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup
@ 2018-05-09 15:27 Shreyansh Jain
  2018-05-09 15:27 ` [dpdk-stable] [PATCH 2/2] bus/fslmc: remove dead code Shreyansh Jain
  2018-05-10 10:46 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Hemant Agrawal
  0 siblings, 2 replies; 5+ messages in thread
From: Shreyansh Jain @ 2018-05-09 15:27 UTC (permalink / raw)
  To: thomas; +Cc: dev, Shreyansh Jain, stable

Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
Coverity issue: 268327
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 36 ++++++++++++++++++++++------------
 1 file changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 6ecd64aa2..9786143d8 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -572,38 +572,39 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
 static int
 fslmc_process_mcp(struct rte_dpaa2_device *dev)
 {
+	int ret;
 	intptr_t v_addr;
-	char *dev_name;
+	char *dev_name = NULL;
 	struct fsl_mc_io dpmng  = {0};
 	struct mc_version mc_ver_info = {0};
 
 	rte_mcp_ptr_list = malloc(sizeof(void *) * 1);
 	if (!rte_mcp_ptr_list) {
 		DPAA2_BUS_ERR("Unable to allocate MC portal memory");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto cleanup;
 	}
 
 	dev_name = strdup(dev->device.name);
 	if (!dev_name) {
 		DPAA2_BUS_ERR("Unable to allocate MC device name memory");
-		free(rte_mcp_ptr_list);
-		rte_mcp_ptr_list = NULL;
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto cleanup;
 	}
 
 	v_addr = vfio_map_mcp_obj(&vfio_group, dev_name);
 	if (v_addr == (intptr_t)MAP_FAILED) {
 		DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno);
-		free(rte_mcp_ptr_list);
-		rte_mcp_ptr_list = NULL;
-		return -1;
+		ret = -1;
+		goto cleanup;
 	}
 
 	/* check the MC version compatibility */
 	dpmng.regs = (void *)v_addr;
 	if (mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info)) {
 		DPAA2_BUS_ERR("Unable to obtain MC version");
-		return -1;
+		ret = -1;
+		goto cleanup;
 	}
 
 	if ((mc_ver_info.major != MC_VER_MAJOR) ||
@@ -613,13 +614,24 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 			      MC_VER_MAJOR, MC_VER_MINOR,
 			      mc_ver_info.major, mc_ver_info.minor,
 			      mc_ver_info.revision);
-		free(rte_mcp_ptr_list);
-		rte_mcp_ptr_list = NULL;
-		return -1;
+		ret = -1;
+		goto cleanup;
 	}
 	rte_mcp_ptr_list[0] = (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;
+	}
+
+	return ret;
 }
 
 int
-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-stable] [PATCH 2/2] bus/fslmc: remove dead code
  2018-05-09 15:27 [dpdk-stable] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Shreyansh Jain
@ 2018-05-09 15:27 ` Shreyansh Jain
  2018-05-10 10:46   ` [dpdk-stable] [dpdk-dev] " Hemant Agrawal
  2018-05-10 10:46 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Hemant Agrawal
  1 sibling, 1 reply; 5+ messages in thread
From: Shreyansh Jain @ 2018-05-09 15:27 UTC (permalink / raw)
  To: thomas; +Cc: dev, Shreyansh Jain, stable

Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
Coverity issue: 268338
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 9786143d8..113c96d49 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -668,9 +668,6 @@ fslmc_vfio_process_group(void)
 	}
 
 	TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
-		if (!dev)
-			break;
-
 		switch (dev->dev_type) {
 		case DPAA2_ETH:
 		case DPAA2_CRYPTO:
-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup
  2018-05-09 15:27 [dpdk-stable] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Shreyansh Jain
  2018-05-09 15:27 ` [dpdk-stable] [PATCH 2/2] bus/fslmc: remove dead code Shreyansh Jain
@ 2018-05-10 10:46 ` Hemant Agrawal
  2018-05-13 22:47   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Hemant Agrawal @ 2018-05-10 10:46 UTC (permalink / raw)
  To: Shreyansh Jain, thomas; +Cc: dev, stable

On 5/9/2018 8:57 PM, Shreyansh Jain wrote:
> Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
> Coverity issue: 268338
> Cc: stable@dpdk.org
>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 2/2] bus/fslmc: remove dead code
  2018-05-09 15:27 ` [dpdk-stable] [PATCH 2/2] bus/fslmc: remove dead code Shreyansh Jain
@ 2018-05-10 10:46   ` Hemant Agrawal
  0 siblings, 0 replies; 5+ messages in thread
From: Hemant Agrawal @ 2018-05-10 10:46 UTC (permalink / raw)
  To: Shreyansh Jain, thomas; +Cc: dev, stable

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shreyansh Jain
Sent: Wednesday, May 9, 2018 8:58 PM
To: thomas@monjalon.net
Cc: dev@dpdk.org; Shreyansh Jain <shreyansh.jain@nxp.com>; stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] bus/fslmc: remove dead code

Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions") Coverity issue: 268338
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup
  2018-05-10 10:46 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Hemant Agrawal
@ 2018-05-13 22:47   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-05-13 22:47 UTC (permalink / raw)
  To: Shreyansh Jain; +Cc: dev, Hemant Agrawal, stable

10/05/2018 12:46, Hemant Agrawal:
> On 5/9/2018 8:57 PM, Shreyansh Jain wrote:
> > Fixes: 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")
> > Coverity issue: 268338
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> > ---
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-13 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 15:27 [dpdk-stable] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Shreyansh Jain
2018-05-09 15:27 ` [dpdk-stable] [PATCH 2/2] bus/fslmc: remove dead code Shreyansh Jain
2018-05-10 10:46   ` [dpdk-stable] [dpdk-dev] " Hemant Agrawal
2018-05-10 10:46 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/fslmc: fix memory leak and cleanup Hemant Agrawal
2018-05-13 22:47   ` Thomas Monjalon

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).