mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@redhat.com, namhyung@kernel.org, allison@lohutok.net,
	rostedt@goodmis.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] perf probe: Fix an error handling path in 'parse_perf_probe_command()'
Date: Tue, 17 Mar 2020 23:16:13 +0900	[thread overview]
Message-ID: <20200317231613.af181e378e7c09ea97097314@kernel.org> (raw)
In-Reply-To: <20200315201259.29190-1-christophe.jaillet@wanadoo.fr>

On Sun, 15 Mar 2020 21:12:59 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> If a memory allocation fail, we should branch to the error handling path in
> order to free some resources allocated a few lines above.
> 

Good catch!

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you,

> Fixes: 15354d546986 ("perf probe: Generate event name with line number")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  tools/perf/util/probe-event.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index eea132f512b0..65a615ee4b4c 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -1683,8 +1683,10 @@ int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev)
>  	if (!pev->event && pev->point.function && pev->point.line
>  			&& !pev->point.lazy_line && !pev->point.offset) {
>  		if (asprintf(&pev->event, "%s_L%d", pev->point.function,
> -			pev->point.line) < 0)
> -			return -ENOMEM;
> +			pev->point.line) < 0) {
> +			ret = -ENOMEM;
> +			goto out;
> +		}
>  	}
>  
>  	/* Copy arguments and ensure return probe has no C argument */
> -- 
> 2.20.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

      reply	other threads:[~2020-03-17 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-15 20:12 Christophe JAILLET
2020-03-17 14:16 ` Masami Hiramatsu [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=20200317231613.af181e378e7c09ea97097314@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=allison@lohutok.net \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=jolsa@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome