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]
Message-ID: <1363703711.5938.20.camel@gandalf.local.home>
Date:	Tue, 19 Mar 2013 10:35:11 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [PATCH 3/9] perf util: Get rid of write_or_die() from
 trace-event-info.c

On Tue, 2013-03-19 at 17:53 +0900, Namhyung Kim wrote:

>  struct tracing_data *tracing_data_get(struct list_head *pattrs,
> @@ -465,6 +516,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
>  {
>  	struct tracepoint_path *tps;
>  	struct tracing_data *tdata;
> +	int err1, err2, err3, err4, err5, err6;
>  
>  	output_fd = fd;
>  
> @@ -498,12 +550,12 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
>  		output_fd = temp_fd;
>  	}
>  
> -	tracing_data_header();
> -	read_header_files();
> -	read_ftrace_files(tps);
> -	read_event_files(tps);
> -	read_proc_kallsyms();
> -	read_ftrace_printk();
> +	err1 = tracing_data_header();
> +	err2 = read_header_files();
> +	err3 = read_ftrace_files(tps);
> +	err4 = read_event_files(tps);
> +	err5 = read_proc_kallsyms();
> +	err6 = read_ftrace_printk();

ugly ugly ugly

What about:
	int err = 0;

	err += tracing_data_header();
	err += read_header_files();
	[...]

	if (err < 0) {
		free(tdata);
		tdata = NULL;
	}

Also, is the only clean up needed be freeing tdata?

-- Steve


>  
>  	/*
>  	 * All tracing data are stored by now, we can restore
> @@ -515,22 +567,31 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
>  		output_fd = fd;
>  	}
>  
> +	if (err1 + err2 + err3 + err4 + err5 + err6 < 0) {
> +		free(tdata);
> +		tdata = NULL;
> +	}
> +
>  	put_tracepoints_path(tps);
>  	return tdata;
>  }
>  


--
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