[dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been queued to stable release 18.08.1

Kevin Traynor ktraynor at redhat.com
Fri Nov 23 11:26:06 CET 2018


Hi,

FYI, your patch has been queued to stable release 18.08.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/29/18. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the patch applied
to the branch. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.

Thanks.

Kevin Traynor

---
>From 7d736d77d9747cfe535d51faa00536b1c54cfe37 Mon Sep 17 00:00:00 2001
From: Ziye Yang <ziye.yang at intel.com>
Date: Wed, 12 Sep 2018 09:31:50 +0800
Subject: [PATCH] eal/linux: fix memory leak of logid

[ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ]

This patch is used to fix the memory leak issue of logid.
We use the ASAN test in SPDK when integrating DPDK and
find this memory leak issue.

Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")

Signed-off-by: Ziye Yang <ziye.yang at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e59ac6577..211affff8 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -794,5 +794,6 @@ rte_eal_init(int argc, char **argv)
 	pthread_t thread_id;
 	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
-	const char *logid;
+	const char *p;
+	static char logid[PATH_MAX];
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
@@ -811,7 +812,6 @@ rte_eal_init(int argc, char **argv)
 	}
 
-	logid = strrchr(argv[0], '/');
-	logid = strdup(logid ? logid + 1: argv[0]);
-
+	p = strrchr(argv[0], '/');
+	strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
 	thread_id = pthread_self();
 
-- 
2.19.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-23 10:22:54.306233759 +0000
+++ 0002-eal-linux-fix-memory-leak-of-logid.patch	2018-11-23 10:22:54.000000000 +0000
@@ -1,14 +1,15 @@
-From e4f2c1421d8036a4778c43bf25201ef5fb37ad6f Mon Sep 17 00:00:00 2001
+From 7d736d77d9747cfe535d51faa00536b1c54cfe37 Mon Sep 17 00:00:00 2001
 From: Ziye Yang <ziye.yang at intel.com>
 Date: Wed, 12 Sep 2018 09:31:50 +0800
 Subject: [PATCH] eal/linux: fix memory leak of logid
 
+[ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ]
+
 This patch is used to fix the memory leak issue of logid.
 We use the ASAN test in SPDK when integrating DPDK and
 find this memory leak issue.
 
 Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ziye Yang <ziye.yang at intel.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
@@ -17,10 +18,10 @@
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
-index 7b11375f4..67116eee2 100644
+index e59ac6577..211affff8 100644
 --- a/lib/librte_eal/linuxapp/eal/eal.c
 +++ b/lib/librte_eal/linuxapp/eal/eal.c
-@@ -826,5 +826,6 @@ rte_eal_init(int argc, char **argv)
+@@ -794,5 +794,6 @@ rte_eal_init(int argc, char **argv)
  	pthread_t thread_id;
  	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
 -	const char *logid;
@@ -28,7 +29,7 @@
 +	static char logid[PATH_MAX];
  	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
  	char thread_name[RTE_MAX_THREAD_NAME_LEN];
-@@ -843,7 +844,6 @@ rte_eal_init(int argc, char **argv)
+@@ -811,7 +812,6 @@ rte_eal_init(int argc, char **argv)
  	}
  
 -	logid = strrchr(argv[0], '/');


More information about the stable mailing list