[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2104171559260.44318@angie.orcam.me.uk>
Date: Sat, 17 Apr 2021 16:01:36 +0200 (CEST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: David Laight <David.Laight@...LAB.COM>
cc: Joe Perches <joe@...ches.com>, Khalid Aziz <khalid@...ehiking.org>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Christoph Hellwig <hch@....de>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH 1/5] scsi: BusLogic: Fix missing `pr_cont' use
On Sat, 17 Apr 2021, David Laight wrote:
> > > In patch 2, vscnprintf should probably be used to make sure it's
> > > 0 terminated.
> >
> > Why? C99 has this[1]:
> >
> > "The vsnprintf function is equivalent to snprintf, with the variable
> > argument list replaced by arg, which shall have been initialized by the
> > va_start macro (and possibly subsequent va_arg calls)."
>
> vscnprintf() is normally the function you want (not vsnprintf())
> because the return value is the number of characters actually
> put into the buffer, not the number that would have been written
> had the buffer been long enough.
Good catch, thank you! I'll respin the series then. Thank you for the
background story too!
Maciej
Powered by blists - more mailing lists