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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 8 Jun 2017 13:54:38 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     David Carrillo-Cisneros <davidcc@...gle.com>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Andi Kleen <ak@...ux.intel.com>, Simon Que <sque@...omium.org>,
        Wang Nan <wangnan0@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
        He Kuang <hekuang@...wei.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Stephane Eranian <eranian@...gle.com>,
        Paul Turner <pjt@...gle.com>
Subject: Re: [PATCH v3 08/15] perf header: use struct feat_fd to process
 header records

On Tue, Jun 06, 2017 at 12:07:15AM -0700, David Carrillo-Cisneros wrote:

SNIP

> +static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
>  {
>  	u32 nr, i;
>  	char *str;
>  	struct strbuf sb;
> -	int cpu_nr = ph->env.nr_cpus_avail;
> +	int cpu_nr = ff->ph->env.nr_cpus_avail;
>  	u64 size = 0;
> +	struct perf_header *ph = ff->ph;
> +	u64 start_offset = ff->offset;
>  
>  	ph->env.cpu = calloc(cpu_nr, sizeof(*ph->env.cpu));
>  	if (!ph->env.cpu)
>  		return -1;
>  
> -	if (do_read_u32(fd, ph, &nr))
> +	if (do_read_u32(ff->fd, ff->ph, &nr))
>  		goto free_cpu;
>  
>  	ph->env.nr_sibling_cores = nr;
> @@ -1764,7 +1753,7 @@ static int process_cpu_topology(struct perf_file_section *section,
>  		goto free_cpu;
>  
>  	for (i = 0; i < nr; i++) {
> -		str = do_read_string(fd, ph);
> +		str = do_read_string(ff->fd, ff->ph);
>  		if (!str)
>  			goto error;
>  
> @@ -1776,14 +1765,14 @@ static int process_cpu_topology(struct perf_file_section *section,
>  	}
>  	ph->env.sibling_cores = strbuf_detach(&sb, NULL);
>  
> -	if (do_read_u32(fd, ph, &nr))
> +	if (do_read_u32(ff->fd, ff->ph, &nr))
>  		return -1;
>  
>  	ph->env.nr_sibling_threads = nr;
>  	size += sizeof(u32);
>  
>  	for (i = 0; i < nr; i++) {
> -		str = do_read_string(fd, ph);
> +		str = do_read_string(ff->fd, ff->ph);
>  		if (!str)
>  			goto error;
>  
> @@ -1799,18 +1788,18 @@ static int process_cpu_topology(struct perf_file_section *section,
>  	 * The header may be from old perf,
>  	 * which doesn't include core id and socket id information.
>  	 */
> -	if (section->size <= size) {
> +	if (ff->size <= ff->offset - start_offset) {

I'm lost here? how is ff->offset incremented? what's 'size' good for now?

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ