From: David Laight <David.Laight@ACULAB.COM>
To: 'Christophe JAILLET' <christophe.jaillet@wanadoo.fr>,
"peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"acme@kernel.org" <acme@kernel.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"alexander.shishkin@linux.intel.com"
<alexander.shishkin@linux.intel.com>,
"jolsa@redhat.com" <jolsa@redhat.com>,
"namhyung@kernel.org" <namhyung@kernel.org>,
"kan.liang@linux.intel.com" <kan.liang@linux.intel.com>,
"zhe.he@windriver.com" <zhe.he@windriver.com>,
"dzickus@redhat.com" <dzickus@redhat.com>,
"jstancek@redhat.com" <jstancek@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: RE: [PATCH] perf cpumap: Use scnprintf instead of snprintf
Date: Mon, 23 Mar 2020 15:11:40 +0000 [thread overview]
Message-ID: <c0441e54a07e424f9646ca232d44e9d8@AcuMS.aculab.com> (raw)
In-Reply-To: <20200322172523.2677-1-christophe.jaillet@wanadoo.fr>
From: Christophe JAILLET
> Sent: 22 March 2020 17:25
> 'scnprintf' returns the number of characters written in the output buffer
> excluding the trailing '\0', instead of the number of characters which
> would be generated for the given input.
>
> Both function return a number of characters, excluding the trailing '\0'.
> So comparaison to check if it overflows, should be done against max_size-1.
> Comparaison against max_size can never match.
NACK.
Since snprintf() returns the number of characters it would have
written to an infinite buffer the comparison can 'match'.
However it should test for (ret >= PATH_MAX).
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-03-23 15:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 17:25 [PATCH] perf cpumap: Use scnprintf instead of snprintf Christophe JAILLET
2020-03-23 11:03 ` Dan Carpenter
2020-03-23 12:08 ` Christophe JAILLET
2020-03-23 12:08 ` Christophe JAILLET
2020-03-23 12:16 ` Dan Carpenter
2020-03-23 15:11 ` David Laight [this message]
2020-03-23 15:20 ` Christophe JAILLET
2020-03-23 15:20 ` Christophe JAILLET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0441e54a07e424f9646ca232d44e9d8@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dzickus@redhat.com \
--cc=jolsa@redhat.com \
--cc=jstancek@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=zhe.he@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox