From: Masami Hiramatsu <mhiramat@redhat.com>
To: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
linux-kernel@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Frédéric Weisbecker" <fweisbec@gmail.com>,
"Mike Galbraith" <efault@gmx.de>,
"Paul Mackerras" <paulus@samba.org>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Tom Zanussi" <tzanussi@gmail.com>
Subject: Re: [PATCH 4/5] perf probe: Don't call die()
Date: Tue, 18 May 2010 20:33:40 -0400 [thread overview]
Message-ID: <4BF331E4.4010906@redhat.com> (raw)
In-Reply-To: <1274228881-8035-5-git-send-email-acme@infradead.org>
Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Functions that were calling xzalloc also returned -1 when, for other
> reasons, it could fail, and the calleds are coping with failures, so
> stop using die() and xzalloc().
>
OK, but could you return -ENOMEM if failed to call zalloc()?
> Cc: Frédéric Weisbecker <fweisbec@gmail.com>
> Cc: Masami Hiramatsu <mhiramat@redhat.com>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Tom Zanussi <tzanussi@gmail.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/builtin-probe.c | 10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 61c6d70..99b1728 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -65,8 +65,10 @@ static int parse_probe_event(const char *str)
> int ret;
>
> pr_debug("probe-definition(%d): %s\n", params.nevents, str);
> - if (++params.nevents == MAX_PROBES)
> - die("Too many probes (> %d) are specified.", MAX_PROBES);
> + if (++params.nevents == MAX_PROBES) {
> + pr_err("Too many probes (> %d) were specified.", MAX_PROBES);
> + return -1;
> + }
>
> /* Parse a perf-probe command into event */
> ret = parse_perf_probe_command(str, pev);
> @@ -84,7 +86,9 @@ static int parse_probe_event_argv(int argc, const char **argv)
> len = 0;
> for (i = 0; i < argc; i++)
> len += strlen(argv[i]) + 1;
> - buf = xzalloc(len + 1);
> + buf = zalloc(len + 1);
> + if (buf == NULL)
> + return -1;
> len = 0;
> for (i = 0; i < argc; i++)
> len += sprintf(&buf[len], "%s ", argv[i]);
--
Masami Hiramatsu
e-mail: mhiramat@redhat.com
next prev parent reply other threads:[~2010-05-19 0:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 0:27 [GIT PULL 0/5] perf tools fixes and improvements Arnaldo Carvalho de Melo
2010-05-19 0:27 ` [PATCH 1/5] perf stat: add perf stat -B to pretty print large numbers Arnaldo Carvalho de Melo
2010-05-19 0:27 ` [PATCH 2/5] perf tools: Remove some unused functions Arnaldo Carvalho de Melo
2010-05-19 0:27 ` [PATCH 3/5] perf probe: Fix some error exit paths Arnaldo Carvalho de Melo
2010-05-19 1:07 ` Masami Hiramatsu
2010-05-19 0:28 ` [PATCH 4/5] perf probe: Don't call die() Arnaldo Carvalho de Melo
2010-05-19 0:33 ` Masami Hiramatsu [this message]
2010-05-19 0:28 ` [PATCH 5/5] perf tools: remove xstrndup, xmalloc, xzalloc Arnaldo Carvalho de Melo
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=4BF331E4.4010906@redhat.com \
--to=mhiramat@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@infradead.org \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tzanussi@gmail.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
Powered by JetHome