Subject: Re: [PATCH][next] powerpc/spufs: Replace snprintf() with the safer scnprintf() variant

From: Paulo Miguel Almeida <[email-masked]>
Date: Sat, 19 Oct 2024 12:50:43 +1300

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.