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:	Wed, 11 Feb 2015 11:46:05 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Adrian Hunter <adrian.hunter@...el.com>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	Paul Mackerras <paulus@...ba.org>,
	Jiri Olsa <jolsa@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Borislav Petkov <bp@...e.de>,
	Hemant Kumar <hemant@...ux.vnet.ibm.com>
Subject: Re: [perf/core PATCH v2 2/4] perf buildid-cache: Consolidate
 .build-id cache path generators

Em Tue, Feb 10, 2015 at 06:18:53PM +0900, Masami Hiramatsu escreveu:
> +static int asnprintf(char **strp, size_t size, const char *fmt, ...)
> +{
> +	va_list ap;
> +	int ret;
> +	if (!strp)
> +		return -EINVAL;
> +	va_start(ap, fmt);
> +	if (*strp)
> +		ret = vsnprintf(*strp, size, fmt, ap);
> +	else
> +		ret = vasprintf(strp, fmt, ap);
> +	va_end(ap);
> +	return ret;
> +}
> +static char *build_id__filename(const char *sbuild_id, char *bf, size_t size)
> +{
> +	char *tmp = bf;
> +	int ret = asnprintf(&bf, size, "%s/.build-id/%.2s/%s", buildid_dir,
> +			    sbuild_id, sbuild_id + 2);
> +	if (ret < 0 || (tmp && size < (unsigned int)ret))
> +		return NULL;

This is a good thing, i.e. checking if the formatting truncated
something, i.e. vsnprintf honours 'size' but may return more than that,
but next time try to get it into a separate patch :-)

Anyway, after scratching my head with this extra thing/re-reading the
vsnprintf man page, I'm applying this patch, thanks.

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