linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Zheng Zengkai <zhengzengkai@huawei.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	namhyung@kernel.org, linux-kernel@vger.kernel.org,
	huawei.libin@huawei.com
Subject: Re: [PATCH -next] perf util: Fix memory leak in __parse_regs()
Date: Mon, 7 Dec 2020 13:45:26 -0300	[thread overview]
Message-ID: <20201207164526.GH125383@kernel.org> (raw)
In-Reply-To: <0e52c7be-ca81-2f4d-ee2f-8f9ced382f60@huawei.com>

Em Fri, Nov 27, 2020 at 03:45:40PM +0800, Zheng Zengkai escreveu:
> Ping...

Thanks, applied.

- Arnaldo
 
> > On Fri, Jul 03, 2020 at 05:33:44PM +0800, Zheng Zengkai wrote:
> > > when using perf record option '-I' or '--user-regs='
> > > along with argument '?' to list available register names,
> > > memory of variable 'os' allocated by strdup() needs to be released
> > > before __parse_regs() returns, otherwise memory leak will occur.
> > > 
> > > Fixes: bcc84ec65ad1 ("perf record: Add ability to name registers to record")
> > > Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
> > Acked-by: Jiri Olsa <jolsa@redhat.com>
> > 
> > thanks,
> > jirka
> > 
> > > ---
> > >   tools/perf/util/parse-regs-options.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c
> > > index e687497b3aac..a4a100425b3a 100644
> > > --- a/tools/perf/util/parse-regs-options.c
> > > +++ b/tools/perf/util/parse-regs-options.c
> > > @@ -54,7 +54,7 @@ __parse_regs(const struct option *opt, const char *str, int unset, bool intr)
> > >   #endif
> > >   				fputc('\n', stderr);
> > >   				/* just printing available regs */
> > > -				return -1;
> > > +				goto error;
> > >   			}
> > >   #ifdef HAVE_PERF_REGS_SUPPORT
> > >   			for (r = sample_reg_masks; r->name; r++) {
> > > -- 
> > > 2.20.1
> > > 
> > .
> > 

-- 

- Arnaldo

      reply	other threads:[~2020-12-07 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03  9:33 [PATCH -next] perf util: Fix memory leak in __parse_regs() Zheng Zengkai
2020-07-03 10:31 ` Jiri Olsa
2020-11-27  7:45   ` Zheng Zengkai
2020-12-07 16:45     ` Arnaldo Carvalho de Melo [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=20201207164526.GH125383@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=huawei.libin@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=zhengzengkai@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;
as well as URLs for NNTP newsgroup(s).