Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945975AbbEOC1U (ORCPT ); Thu, 14 May 2015 22:27:20 -0400 Received: from lgeamrelo04.lge.com ([156.147.1.127]:62477 "EHLO lgeamrelo04.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423217AbbEOC1S (ORCPT ); Thu, 14 May 2015 22:27:18 -0400 X-Original-SENDERIP: 10.177.220.203 X-Original-MAILFROM: namhyung@kernel.org Date: Fri, 15 May 2015 11:17:31 +0900 From: Namhyung Kim To: Wang Nan Cc: paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, jolsa@kernel.org, adrian.hunter@intel.com, dsahern@gmail.com, linux-kernel@vger.kernel.org, lizefan@huawei.com, pi3orama@huawei.com Subject: Re: [PATCH] tools perf: set vmlinux_path__nr_entries to 0 in vmlinux_path__exit. Message-ID: <20150515021731.GB19104@sejong> References: <1431606150-163436-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1431606150-163436-1-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1582 Lines: 48 Hello, On Thu, May 14, 2015 at 12:22:30PM +0000, Wang Nan wrote: > 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 Thanks, Namhyung > --- > 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 201f6c4c..451777f 100644 > --- a/tools/perf/util/symbol.c > +++ b/tools/perf/util/symbol.c > @@ -1802,6 +1802,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); > } > -- > 1.8.3.4 > > -- > 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/ -- 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/