mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
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.
Date: Fri, 15 May 2015 11:17:31 +0900	[thread overview]
Message-ID: <20150515021731.GB19104@sejong> (raw)
In-Reply-To: <1431606150-163436-1-git-send-email-wangnan0@huawei.com>

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 <wangnan0@huawei.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

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/

      reply	other threads:[~2015-05-15  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 12:22 Wang Nan
2015-05-15  2:17 ` Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150515021731.GB19104@sejong \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=pi3orama@huawei.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®