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, 02 Oct 2013 09:54:40 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Ingo Molnar <mingo@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <peterz@...radead.org>,
	Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>,
	Waiman Long <Waiman.Long@...com>,
	Stephane Eranian <eranian@...gle.com>,
	Jiri Olsa <jolsa@...hat.com>, David Ahern <dsahern@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf: Support for Openembedded/Yocto -dbg packages

Hi Ingo and Arnaldo,

On Wed, 18 Sep 2013 15:29:03 +0200, Ingo Molnar wrote:
> * Arnaldo Carvalho de Melo <acme@...stprotocols.net> wrote:
>
>> Em Wed, Sep 18, 2013 at 12:18:01PM +0200, Peter Zijlstra escreveu:
>> > On Wed, Sep 18, 2013 at 12:02:12PM +0200, Ricardo Ribalda Delgado wrote:
>> > > Perhaps this is even more clear than v2:
>> 
>> > > len = snprintf(file, size, "%s", symbol_conf.symfs);
>> > > size -= len;
>> > > file += len;
>> > > len = snprintf(file, MIN(size,(last_slash - dso->long_name) + 2),
>> > > "%s",  dso->long_name);
>> > > size -= len;
>> > > file += len;
>> > > len = snprintf(file, size, ".debug%s",  last_slash);
>> 
>> > len = 0;
>> 
>> > len += snprintf(str + len, size - len, ...);
>> > len += snprintf(str + len, size - len, ...);
>> 
>> And avoid snprintf like the plague, use scnprintf instead...  See
>> e7f01d1e3d8d501deb8abeaa269d5d48a703b8b0 for details :-)
>
> Hm, could we do:
>
> 	#define snprintf scnprintf
>
> or:
>
> 	#define snprintf(x...) BUILD_BUG()
>
> ?
>
> I don't think there's any valid code, except printf wrappers (which we 
> don't have in perf), where the semantics of snprintf() would be needed.

There are some places that use snprintf() to query the actual length:

tools/perf/util/srcline.c:245:	size = snprintf(NULL, 0, "%s:%u", file, line) + 1;
tools/perf/util/values.c:147:		width = snprintf(NULL, 0, "%d", values->pid[i]);
tools/perf/util/values.c:150:		width = snprintf(NULL, 0, "%d", values->tid[i]);
tools/perf/util/values.c:154:			width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]);
tools/perf/util/values.c:189:		width = snprintf(NULL, 0, "%d", values->pid[i]);
tools/perf/util/values.c:192:		width = snprintf(NULL, 0, "%d", values->tid[i]);
tools/perf/util/values.c:200:		width = snprintf(NULL, 0, "%" PRIx64, values->counterrawid[j]);
tools/perf/util/values.c:206:			width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]);


Thanks,
Namhyung
--
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