lkml.org 
[lkml]   [2023]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] bcachefs: Use snprintf() instead of scnprintf() when appropriate
On Tue, Sep 19, 2023 at 09:23:47PM +0200, Christophe JAILLET wrote:
> Le 19/09/2023 à 21:02, Kent Overstreet a écrit :
> > On Tue, Sep 19, 2023 at 09:17:27AM -0400, Brian Foster wrote:
> > > On Sat, Sep 16, 2023 at 09:30:19AM +0200, Christophe JAILLET wrote:
> > > > snprintf() and scnprintf() are the same, except for the returned value.
> > > > When this value is not used, it is more logical to use snprintf() which is
> > > > slightly simpler.
> > > >
> > > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > > > ---
> > >
> > > Seems reasonable:
> > >
> > > Reviewed-by: Brian Foster <bfoster@redhat.com>
> >
> > No, let's stay with scnprintf as the default - snprintf should be
> > deprecated except for when its return value is actually needed, using it
> > incorrectly has been a source of buffer overruns in the past.
> >
>
> Ok, I was not aware of it.
>
> In this case, there are also some s/snprintf/scnprintf/ opportunities in
> fs/bcachefs
>
> Does it make sense to update them or is it too low value changes?

Not terribly important - long term, I want to depracate both snprintf
and scnprintf and convert everything to printbufs.

\
 
 \ /
  Last update: 2023-09-20 02:41    [W:0.030 / U:1.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site