Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753848AbbETM0s (ORCPT ); Wed, 20 May 2015 08:26:48 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56891 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753820AbbETM0p (ORCPT ); Wed, 20 May 2015 08:26:45 -0400 Date: Wed, 20 May 2015 05:25:56 -0700 From: tip-bot for Wang Nan Message-ID: Cc: namhyung@kernel.org, daniel@iogearbox.net, masami.hiramatsu.pt@hitachi.com, acme@redhat.com, hpa@zytor.com, mingo@kernel.org, dsahern@gmail.com, lizefan@huawei.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, wangnan0@huawei.com, tglx@linutronix.de, a.p.zijlstra@chello.nl, brendan.d.gregg@gmail.com, paulus@samba.org Reply-To: hpa@zytor.com, acme@redhat.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, dsahern@gmail.com, mingo@kernel.org, namhyung@kernel.org, daniel@iogearbox.net, tglx@linutronix.de, paulus@samba.org, a.p.zijlstra@chello.nl, brendan.d.gregg@gmail.com, linux-kernel@vger.kernel.org, jolsa@kernel.org, wangnan0@huawei.com In-Reply-To: <1431860222-61636-3-git-send-email-wangnan0@huawei.com> References: <1431860222-61636-3-git-send-email-wangnan0@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit Git-Commit-ID: c4f035473d93c1594d8225f6dd97332317820801 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2093 Lines: 54 Commit-ID: c4f035473d93c1594d8225f6dd97332317820801 Gitweb: http://git.kernel.org/tip/c4f035473d93c1594d8225f6dd97332317820801 Author: Wang Nan AuthorDate: Sun, 17 May 2015 10:56:27 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 18 May 2015 10:17:39 -0300 perf tools: Set vmlinux_path__nr_entries to 0 in vmlinux_path__exit Original vmlinux_path__exit() doesn't revert vmlinux_path__nr_entries to its original state. After the while loop vmlinux_path__nr_entries becomes -1 instead of 0. This makes a problem that, if runs twice, during the second run vmlinux_path__init() will set vmlinux_path[-1] to strdup("vmlinux"), corrupts random memory. This patch reset vmlinux_path__nr_entries to 0 after the while loop. Signed-off-by: Wang Nan Acked-by: Namhyung Kim Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: David Ahern Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Paul Mackerras Cc: Peter Zijlstra Cc: pi3orama@163.com Cc: Zefan Li Link: http://lkml.kernel.org/r/1431860222-61636-3-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 9ef8b89..82a31fd 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1819,6 +1819,7 @@ static void vmlinux_path__exit(void) { while (--vmlinux_path__nr_entries >= 0) zfree(&vmlinux_path[vmlinux_path__nr_entries]); + vmlinux_path__nr_entries = 0; zfree(&vmlinux_path); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/