DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: free leaked logid storage
@ 2018-07-22 10:55 Aaron Conole
  2018-07-22 11:09 ` Aaron Conole
  2018-07-22 11:16 ` [dpdk-dev] [PATCH v2] eal: free leaked storage Aaron Conole
  0 siblings, 2 replies; 6+ messages in thread
From: Aaron Conole @ 2018-07-22 10:55 UTC (permalink / raw)
  To: dev

Previously, the logid variable would be leaked when the function
returned.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 65 ++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 21 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d2d5aae80..3208e7079 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -833,7 +833,8 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_cpu_init() < 0) {
 		rte_eal_init_alert("Cannot detect lcores.");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	fctret = eal_parse_args(argc, argv);
@@ -841,27 +842,31 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Invalid 'command line' arguments.");
 		rte_errno = EINVAL;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (eal_plugins_init() < 0) {
 		rte_eal_init_alert("Cannot init plugins\n");
 		rte_errno = EINVAL;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (eal_option_device_parse()) {
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	rte_config_init();
 
 	if (rte_eal_intr_init() < 0) {
 		rte_eal_init_alert("Cannot init interrupt-handling thread\n");
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* Put mp channel init before bus scan so that we can init the vdev
@@ -871,7 +876,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("failed to init mp channel\n");
 		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			rte_errno = EFAULT;
-			return -1;
+			fctret = -1;
+			goto finished;
 		}
 	}
 
@@ -879,7 +885,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot scan the buses for devices\n");
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* autodetect the iova mapping mode (default is iova_pa) */
@@ -903,7 +910,8 @@ rte_eal_init(int argc, char **argv)
 			rte_eal_init_alert("Cannot get hugepage information.");
 			rte_errno = EACCES;
 			rte_atomic32_clear(&run_once);
-			return -1;
+			fctret = -1;
+			goto finished;
 		}
 	}
 
@@ -929,7 +937,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot init logging.");
 		rte_errno = ENOMEM;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 #ifdef VFIO_PRESENT
@@ -937,7 +946,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot init VFIO\n");
 		rte_errno = EAGAIN;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 #endif
 	/* in secondary processes, memory init may allocate additional fbarrays
@@ -947,13 +957,15 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_memzone_init() < 0) {
 		rte_eal_init_alert("Cannot init memzone\n");
 		rte_errno = ENODEV;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_memory_init() < 0) {
 		rte_eal_init_alert("Cannot init memory\n");
 		rte_errno = ENOMEM;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* the directories are locked during eal_hugepage_info_init */
@@ -962,25 +974,29 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_malloc_heap_init() < 0) {
 		rte_eal_init_alert("Cannot init malloc heap\n");
 		rte_errno = ENODEV;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_tailqs_init() < 0) {
 		rte_eal_init_alert("Cannot init tail queues for objects\n");
 		rte_errno = EFAULT;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_alarm_init() < 0) {
 		rte_eal_init_alert("Cannot init interrupt-handling thread\n");
 		/* rte_eal_alarm_init sets rte_errno on failure. */
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_timer_init() < 0) {
 		rte_eal_init_alert("Cannot init HPET or TSC timers\n");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	eal_check_mem_on_local_socket();
@@ -1034,20 +1050,24 @@ rte_eal_init(int argc, char **argv)
 	if (ret) {
 		rte_eal_init_alert("rte_service_init() failed\n");
 		rte_errno = ENOEXEC;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* Probe all the buses and devices/drivers on them */
 	if (rte_bus_probe()) {
 		rte_eal_init_alert("Cannot probe devices\n");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 #ifdef VFIO_PRESENT
 	/* Register mp action after probe() so that we got enough info */
-	if (rte_vfio_is_enabled("vfio") && vfio_mp_sync_setup() < 0)
-		return -1;
+	if (rte_vfio_is_enabled("vfio") && vfio_mp_sync_setup() < 0) {
+		fctret = -1;
+		goto finished;
+	}
 #endif
 
 	/* initialize default service/lcore mappings and start running. Ignore
@@ -1056,11 +1076,14 @@ rte_eal_init(int argc, char **argv)
 	ret = rte_service_start_with_defaults();
 	if (ret < 0 && ret != -ENOTSUP) {
 		rte_errno = ENOEXEC;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	rte_eal_mcfg_complete();
 
+finished:
+	free(logid);
 	return fctret;
 }
 
-- 
2.14.3

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

* Re: [dpdk-dev] [PATCH] eal: free leaked logid storage
  2018-07-22 10:55 [dpdk-dev] [PATCH] eal: free leaked logid storage Aaron Conole
@ 2018-07-22 11:09 ` Aaron Conole
  2018-07-22 11:16 ` [dpdk-dev] [PATCH v2] eal: free leaked storage Aaron Conole
  1 sibling, 0 replies; 6+ messages in thread
From: Aaron Conole @ 2018-07-22 11:09 UTC (permalink / raw)
  To: dev

Aaron Conole <aconole@redhat.com> writes:

> Previously, the logid variable would be leaked when the function
> returned.
>
> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---

Ugh.  Ignore this version.  I broke it when I manually rebased.

v2 soon.

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

* [dpdk-dev] [PATCH v2] eal: free leaked storage
  2018-07-22 10:55 [dpdk-dev] [PATCH] eal: free leaked logid storage Aaron Conole
  2018-07-22 11:09 ` Aaron Conole
@ 2018-07-22 11:16 ` Aaron Conole
  2018-08-01 16:30   ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Aaron Conole @ 2018-07-22 11:16 UTC (permalink / raw)
  To: dev

Previously, the logid variable would be leaked when the function
returned.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 71 ++++++++++++++++++++++++++-------------
 1 file changed, 48 insertions(+), 23 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index d2d5aae80..6de7e71b6 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -803,6 +803,7 @@ rte_eal_init(int argc, char **argv)
 	int i, fctret, ret;
 	pthread_t thread_id;
 	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
+	char *logid_storage;
 	const char *logid;
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
@@ -820,8 +821,9 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
-	logid = strrchr(argv[0], '/');
-	logid = strdup(logid ? logid + 1: argv[0]);
+	logid_storage = strrchr(argv[0], '/');
+	logid_storage = strdup(logid_storage ? logid_storage + 1 : argv[0]);
+	logid = logid_storage;
 
 	thread_id = pthread_self();
 
@@ -833,7 +835,8 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_cpu_init() < 0) {
 		rte_eal_init_alert("Cannot detect lcores.");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	fctret = eal_parse_args(argc, argv);
@@ -841,27 +844,31 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Invalid 'command line' arguments.");
 		rte_errno = EINVAL;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (eal_plugins_init() < 0) {
 		rte_eal_init_alert("Cannot init plugins\n");
 		rte_errno = EINVAL;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (eal_option_device_parse()) {
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	rte_config_init();
 
 	if (rte_eal_intr_init() < 0) {
 		rte_eal_init_alert("Cannot init interrupt-handling thread\n");
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* Put mp channel init before bus scan so that we can init the vdev
@@ -871,7 +878,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("failed to init mp channel\n");
 		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 			rte_errno = EFAULT;
-			return -1;
+			fctret = -1;
+			goto finished;
 		}
 	}
 
@@ -879,7 +887,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot scan the buses for devices\n");
 		rte_errno = ENODEV;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* autodetect the iova mapping mode (default is iova_pa) */
@@ -903,7 +912,8 @@ rte_eal_init(int argc, char **argv)
 			rte_eal_init_alert("Cannot get hugepage information.");
 			rte_errno = EACCES;
 			rte_atomic32_clear(&run_once);
-			return -1;
+			fctret = -1;
+			goto finished;
 		}
 	}
 
@@ -929,7 +939,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot init logging.");
 		rte_errno = ENOMEM;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 #ifdef VFIO_PRESENT
@@ -937,7 +948,8 @@ rte_eal_init(int argc, char **argv)
 		rte_eal_init_alert("Cannot init VFIO\n");
 		rte_errno = EAGAIN;
 		rte_atomic32_clear(&run_once);
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 #endif
 	/* in secondary processes, memory init may allocate additional fbarrays
@@ -947,13 +959,15 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_memzone_init() < 0) {
 		rte_eal_init_alert("Cannot init memzone\n");
 		rte_errno = ENODEV;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_memory_init() < 0) {
 		rte_eal_init_alert("Cannot init memory\n");
 		rte_errno = ENOMEM;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* the directories are locked during eal_hugepage_info_init */
@@ -962,25 +976,29 @@ rte_eal_init(int argc, char **argv)
 	if (rte_eal_malloc_heap_init() < 0) {
 		rte_eal_init_alert("Cannot init malloc heap\n");
 		rte_errno = ENODEV;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_tailqs_init() < 0) {
 		rte_eal_init_alert("Cannot init tail queues for objects\n");
 		rte_errno = EFAULT;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_alarm_init() < 0) {
 		rte_eal_init_alert("Cannot init interrupt-handling thread\n");
 		/* rte_eal_alarm_init sets rte_errno on failure. */
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	if (rte_eal_timer_init() < 0) {
 		rte_eal_init_alert("Cannot init HPET or TSC timers\n");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	eal_check_mem_on_local_socket();
@@ -1034,20 +1052,24 @@ rte_eal_init(int argc, char **argv)
 	if (ret) {
 		rte_eal_init_alert("rte_service_init() failed\n");
 		rte_errno = ENOEXEC;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	/* Probe all the buses and devices/drivers on them */
 	if (rte_bus_probe()) {
 		rte_eal_init_alert("Cannot probe devices\n");
 		rte_errno = ENOTSUP;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 #ifdef VFIO_PRESENT
 	/* Register mp action after probe() so that we got enough info */
-	if (rte_vfio_is_enabled("vfio") && vfio_mp_sync_setup() < 0)
-		return -1;
+	if (rte_vfio_is_enabled("vfio") && vfio_mp_sync_setup() < 0) {
+		fctret = -1;
+		goto finished;
+	}
 #endif
 
 	/* initialize default service/lcore mappings and start running. Ignore
@@ -1056,11 +1078,14 @@ rte_eal_init(int argc, char **argv)
 	ret = rte_service_start_with_defaults();
 	if (ret < 0 && ret != -ENOTSUP) {
 		rte_errno = ENOEXEC;
-		return -1;
+		fctret = -1;
+		goto finished;
 	}
 
 	rte_eal_mcfg_complete();
 
+finished:
+	free(logid_storage);
 	return fctret;
 }
 
-- 
2.14.3

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

* Re: [dpdk-dev] [PATCH v2] eal: free leaked storage
  2018-07-22 11:16 ` [dpdk-dev] [PATCH v2] eal: free leaked storage Aaron Conole
@ 2018-08-01 16:30   ` Thomas Monjalon
  2018-08-01 16:51     ` Aaron Conole
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2018-08-01 16:30 UTC (permalink / raw)
  To: Aaron Conole; +Cc: dev

22/07/2018 13:16, Aaron Conole:
> Previously, the logid variable would be leaked when the function
> returned.
> 
> Signed-off-by: Aaron Conole <aconole@redhat.com>

I am not confortable to merge this kind of patch in RC3.
OK to wait 18.11?

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

* Re: [dpdk-dev] [PATCH v2] eal: free leaked storage
  2018-08-01 16:30   ` Thomas Monjalon
@ 2018-08-01 16:51     ` Aaron Conole
  2018-10-28 10:30       ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron Conole @ 2018-08-01 16:51 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

Thomas Monjalon <thomas@monjalon.net> writes:

> 22/07/2018 13:16, Aaron Conole:
>> Previously, the logid variable would be leaked when the function
>> returned.
>> 
>> Signed-off-by: Aaron Conole <aconole@redhat.com>
>
> I am not confortable to merge this kind of patch in RC3.
> OK to wait 18.11?

Sure - please don't forget it, because I probably won't.

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

* Re: [dpdk-dev] [PATCH v2] eal: free leaked storage
  2018-08-01 16:51     ` Aaron Conole
@ 2018-10-28 10:30       ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2018-10-28 10:30 UTC (permalink / raw)
  To: Aaron Conole; +Cc: dev

01/08/2018 18:51, Aaron Conole:
> Thomas Monjalon <thomas@monjalon.net> writes:
> 
> > 22/07/2018 13:16, Aaron Conole:
> >> Previously, the logid variable would be leaked when the function
> >> returned.
> >> 
> >> Signed-off-by: Aaron Conole <aconole@redhat.com>
> >
> > I am not confortable to merge this kind of patch in RC3.
> > OK to wait 18.11?
> 
> Sure - please don't forget it, because I probably won't.

I forgot :(
Now we have a shorter patch:
	https://patches.dpdk.org/patch/44605/
which supersedes this one.

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

end of thread, other threads:[~2018-10-28 10:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-22 10:55 [dpdk-dev] [PATCH] eal: free leaked logid storage Aaron Conole
2018-07-22 11:09 ` Aaron Conole
2018-07-22 11:16 ` [dpdk-dev] [PATCH v2] eal: free leaked storage Aaron Conole
2018-08-01 16:30   ` Thomas Monjalon
2018-08-01 16:51     ` Aaron Conole
2018-10-28 10:30       ` 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).