[dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been queued to LTS release 16.11.9
Luca Boccassi
bluca at debian.org
Mon Oct 29 13:53:28 CET 2018
Hi,
FYI, your patch has been queued to LTS release 16.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/31/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.
Luca Boccassi
---
>From 51c1aeccc92da6948d496ff1fc486581dfcd0eb0 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 59ed78823..bbd6284e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -746,7 +746,8 @@ 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);
- 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];
@@ -756,9 +757,8 @@ rte_eal_init(int argc, char **argv)
if (!rte_atomic32_test_and_set(&run_once))
return -1;
- 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();
eal_log_level_parse(argc, argv);
--
2.19.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2018-10-29 12:48:14.841749286 +0000
+++ 0019-eal-linux-fix-memory-leak-of-logid.patch 2018-10-29 12:48:14.474417981 +0000
@@ -1,14 +1,15 @@
-From e4f2c1421d8036a4778c43bf25201ef5fb37ad6f Mon Sep 17 00:00:00 2001
+From 51c1aeccc92da6948d496ff1fc486581dfcd0eb0 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 59ed78823..bbd6284e7 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
-@@ -825,7 +825,8 @@ rte_eal_init(int argc, char **argv)
+@@ -746,7 +746,8 @@ 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);
@@ -30,9 +31,9 @@
char cpuset[RTE_CPU_AFFINITY_STR_LEN];
char thread_name[RTE_MAX_THREAD_NAME_LEN];
-@@ -842,9 +843,8 @@ rte_eal_init(int argc, char **argv)
+@@ -756,9 +757,8 @@ rte_eal_init(int argc, char **argv)
+ if (!rte_atomic32_test_and_set(&run_once))
return -1;
- }
- logid = strrchr(argv[0], '/');
- logid = strdup(logid ? logid + 1: argv[0]);
@@ -41,7 +42,7 @@
+ strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
thread_id = pthread_self();
- eal_reset_internal_config(&internal_config);
+ eal_log_level_parse(argc, argv);
--
2.19.1
More information about the stable
mailing list