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]
Message-ID: <87oaygf22f.fsf@sejong.aot.lge.com>
Date:	Fri, 30 May 2014 11:11:20 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Jiri Olsa <jolsa@...nel.org>, linux-kernel@...r.kernel.org,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Jean Pihet <jean.pihet@...aro.org>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 13/14] perf tests: Add test for caching dso file descriptors

Hi Jiri,

On Thu, 29 May 2014 10:37:32 +0200, Jiri Olsa wrote:
> On Thu, May 29, 2014 at 09:06:05AM +0900, Namhyung Kim wrote:
>> On Tue, 27 May 2014 09:54:36 +0200, Jiri Olsa wrote:
>> > On Tue, May 27, 2014 at 10:36:44AM +0900, Namhyung Kim wrote:
>> >> On Thu, 15 May 2014 19:23:34 +0200, Jiri Olsa wrote:
>> >> > Adding test that setup test_dso_data__fd_limit and test
>> >> > dso data file descriptors are cached appropriately.
>> >> 
>> >> [SNIP]
>> >> > +static long open_files_cnt(void)
>> >> > +{
>> >> > +	char path[PATH_MAX];
>> >> > +	struct dirent *dent;
>> >> > +	DIR *dir;
>> >> > +	long nr = 0;
>> >> > +	int n;
>> >> > +
>> >> > +	n = scnprintf(path, PATH_MAX, "%s/self/fd", procfs__mountpoint());
>> >> > +	TEST_ASSERT_VAL("couldn't get fd path", n < PATH_MAX);
>> >> 
>> >> Looks like an unnecessary check since the scnprintf() cannot return more
>> >> than (or equal to) PATH_MAX.
>> >
>> > once it's equal it's bad.. as the man says:
>> > "return value of size or more means that the output was  truncated"
>> 
>> Did you see "sn"printf?
>
> yes, I just double checked.. jirka

Please see "scn"printf then. :)  It does something like below..

  i = snprintf(buf, size, ...);
  return (i >= size) ? : size - 1 : i;


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

Powered by Openwall GNU/*/Linux Powered by OpenVZ