From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, naveen@kernel.org,
maddy@linux.ibm.com, arnd@arndb.de, chentao@kylinos.cn,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] powerpc/spufs: Replace snprintf() with the safer scnprintf() variant
Date: Sat, 19 Oct 2024 12:50:43 +1300 [thread overview]
Message-ID: <ZxL0U6bziCxhySUO@mail.google.com> (raw)
In-Reply-To: <20241018153843.GJ29862@gate.crashing.org>
On Fri, Oct 18, 2024 at 10:38:43AM -0500, Segher Boessenkool wrote:
> On Fri, Oct 18, 2024 at 09:28:19PM +1300, Paulo Miguel Almeida wrote:
> > The C99 standard specifies that {v}snprintf() returns the length of the
> > data that *would have been* written if there were enough space.
>
> Not including the trailing zero byte, and it can also return negative if
> there was an encoding error. Yes.
>
> Not that this matters at all for your patch, so why mention it?
>
>
> Segher
Thanks for taking the time to review this patch.
Is the objection with the change in itself or just the commit message?
If it's the later, I'm happy to tweak it to what you would like see.
I added that bit for context so the motivation behind the preference for
scnprintf is clear, otherwise one would ask me why :)
We are phasing out snprint utilisations in which the result is being
used [1]. One of possible ways this *might* take form is that in near
future snprint will have it return void.
[1] https://github.com/KSPP/linux/issues/105#issuecomment-2421244722
- Paulo A.
next prev parent reply other threads:[~2024-10-18 23:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 8:28 [PATCH][next] powerpc/spufs: Replace snprintf() with the safer scnprintf() variant Paulo Miguel Almeida
2024-10-18 15:38 ` Segher Boessenkool
2024-10-18 23:50 ` Paulo Miguel Almeida [this message]
2024-10-19 4:13 ` Segher Boessenkool
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=ZxL0U6bziCxhySUO@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
--cc=arnd@arndb.de \
--cc=chentao@kylinos.cn \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=segher@kernel.crashing.org \
/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;
as well as URLs for NNTP newsgroup(s).