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:	Sun, 12 Jun 2016 12:20:50 +0900
From:	Masami Hiramatsu <mhiramat@...nel.org>
To:	Masami Hiramatsu <mhiramat@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	linux-kernel@...r.kernel.org, Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Hemant Kumar <hemant@...ux.vnet.ibm.com>,
	Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
	Brendan Gregg <brendan.d.gregg@...il.com>
Subject: Re: [PATCH perf/core v10 09/23] perf probe: Show all cached probes

On Sat, 11 Jun 2016 09:28:09 +0900
Masami Hiramatsu <mhiramat@...nel.org> wrote:

> On Thu, 9 Jun 2016 11:22:55 -0300
> Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
> 
> > Em Wed, Jun 08, 2016 at 06:30:30PM +0900, Masami Hiramatsu escreveu:
> > > +char *build_id_cache__origname(const char *sbuild_id)
> > > +{
> > > +	char *linkname;
> > > +	char buf[PATH_MAX];
> > > +	char *ret = NULL, *p;
> > > +	size_t offs = 5;	/* == strlen("../..") */
> > > +
> > > +	linkname = build_id_cache__linkname(sbuild_id, NULL, 0);
> > > +	if (!linkname)
> > > +		return NULL;
> > > +
> > > +	if (readlink(linkname, buf, PATH_MAX) < 0)
> > > +		goto out;
> > > +	/* The link should be "../..<origpath>/<sbuild_id>" */
> > > +	p = strrchr(buf, '/');	/* Cut off the "/<sbuild_id>" */
> > > +	if (p && (p > buf + offs)) {
> > > +		*p = '\0';
> > > +		if (buf[offs + 1] == '[')
> > > +			offs++;	/*
> > > +				 * This is a DSO name, like [kernel.kallsyms].
> > > +				 * Skip the first '/', since this is not the
> > > +				 * cache of a regular file.
> > > +				 */
> > > +		ret = strdup(buf + offs);	/* Skip "../..[/]" */
> > 
> > strdup can fail.
> 
> Ah, right.

In this case, build_id_cache__origname() returns ret immediately(see below),
so we don't need to take reaction about that :)

> > > +	}
> > > +out:
> > > +	free(linkname);
> > > +	return ret;
> > > +}

here, if strdup() fails, this just return NULL. that is OK.

Thanks!
-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ