lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 May 2010 20:33:40 -0400
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Arnaldo Carvalho de Melo <acme@...radead.org>
CC:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Tom Zanussi <tzanussi@...il.com>
Subject: Re: [PATCH 4/5] perf probe: Don't call die()

Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@...hat.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@...il.com>
> Cc: Masami Hiramatsu <mhiramat@...hat.com>
> Cc: Mike Galbraith <efault@....de>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Cc: Tom Zanussi <tzanussi@...il.com>
> LKML-Reference: <new-submission>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.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@...hat.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ