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:	Thu, 3 Mar 2016 14:40:22 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Stephane Eranian <eranian@...gle.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH 2/8] perf tools: Introduce perf_hpp__setup_hists_formats()

On Thu, Mar 03, 2016 at 01:12:02AM +0900, Namhyung Kim wrote:

SNIP

> +struct perf_hpp_fmt *perf_hpp_fmt__copy(struct perf_hpp_fmt *fmt);
> +
>  int hist_entry__filter(struct hist_entry *he, int type, const void *arg);
>  
>  static inline bool perf_hpp__should_skip(struct perf_hpp_fmt *format,
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 590ebf70e6da..29c75f0374c4 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -1908,6 +1908,31 @@ __alloc_dynamic_entry(struct perf_evsel *evsel, struct format_field *field,
>  	return hde;
>  }
>  
> +struct perf_hpp_fmt *perf_hpp_fmt__copy(struct perf_hpp_fmt *fmt)

perf_hpp_fmt__dup might be better

> +{
> +	struct perf_hpp_fmt *new_fmt = NULL;
> +
> +	if (perf_hpp__is_sort_entry(fmt)) {
> +		struct hpp_sort_entry *hse, *new_hse;
> +
> +		hse = container_of(fmt, struct hpp_sort_entry, hpp);
> +		new_hse = memdup(hse, sizeof(*hse));
> +		if (new_hse)
> +			new_fmt = &new_hse->hpp;
> +	} else if (perf_hpp__is_dynamic_entry(fmt)) {
> +		struct hpp_dynamic_entry *hde, *new_hde;
> +
> +		hde = container_of(fmt, struct hpp_dynamic_entry, hpp);
> +		new_hde = memdup(hde, sizeof(*hde));
> +		if (new_hde)
> +			new_fmt = &new_hde->hpp;
> +	} else {
> +		new_fmt = memdup(fmt, sizeof(*fmt));
> +	}

how about also initialize new_fmt's list and sort_list in here

could save some time in future if perf_hpp_fmt__copy is
used in another place, which won't directly initialize them
like you do in add_hierarchy_fmt

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ