From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 1CD8E1B494 for ; Fri, 23 Nov 2018 11:28:01 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 716E4A4023; Fri, 23 Nov 2018 10:28:00 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id F05A71836C; Fri, 23 Nov 2018 10:27:58 +0000 (UTC) From: Kevin Traynor To: Ziye Yang Cc: Ferruh Yigit , dpdk stable Date: Fri, 23 Nov 2018 10:26:06 +0000 Message-Id: <20181123102713.17309-2-ktraynor@redhat.com> In-Reply-To: <20181123102713.17309-1-ktraynor@redhat.com> References: <20181123102713.17309-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 23 Nov 2018 10:28:00 +0000 (UTC) Subject: [dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 10:28:01 -0000 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 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 Reviewed-by: Ferruh Yigit --- 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 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@dpdk.org Signed-off-by: Ziye Yang Reviewed-by: Ferruh Yigit @@ -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], '/');