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, 19 May 2015 15:34:21 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Andi Kleen <andi@...stfloor.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 06/40] perf tools: Add HEADER_DATA_INDEX feature

On Mon, May 18, 2015 at 08:17:23PM +0200, Jiri Olsa wrote:
> On Mon, May 18, 2015 at 09:30:21AM +0900, Namhyung Kim wrote:
> 
> SNIP
> 
> >  
> > +static int process_data_index(struct perf_file_section *section __maybe_unused,
> > +			      struct perf_header *ph, int fd,
> > +			      void *data __maybe_unused)
> > +{
> > +	ssize_t ret;
> > +	u64 nr_idx;
> > +	unsigned i;
> > +	struct perf_file_section *idx;
> > +
> > +	ret = readn(fd, &nr_idx, sizeof(nr_idx));
> > +	if (ret != sizeof(nr_idx))
> > +		return -1;
> > +
> > +	if (ph->needs_swap)
> > +		nr_idx = bswap_64(nr_idx);
> > +
> > +	idx = calloc(nr_idx, sizeof(*idx));
> > +	if (idx == NULL)
> > +		return -1;
> > +
> > +	for (i = 0; i < nr_idx; i++) {
> > +		ret = readn(fd, &idx[i], sizeof(*idx));
> > +		if (ret != sizeof(*idx))
> 
> missing			free(idx);

You're right.  Also it needs to return negative value for error, will update.

Thanks,
Namhyung


> 
> > +			return ret;
> > +
> > +		if (ph->needs_swap) {
> > +			idx[i].offset = bswap_64(idx[i].offset);
> > +			idx[i].size   = bswap_64(idx[i].size);
> > +		}
> > +	}
> > +
> > +	ph->index = idx;
> > +	ph->nr_index = nr_idx;
> > +	return 0;
> 
> SNIP
> 
> --
> 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/
--
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