* [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments
@ 2025-11-03 9:09 Thorsten Blum
2025-11-03 9:42 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-11-03 9:09 UTC (permalink / raw)
To: Petr Mladek, Steven Rostedt, Andy Shevchenko, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton
Cc: Thorsten Blum, linux-kernel
Clarify that the return values of vsprintf() and sprintf() exclude the
trailing NUL character.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
lib/vsprintf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index eb0cb11d0d12..e49f350ee549 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3054,8 +3054,8 @@ EXPORT_SYMBOL(scnprintf);
* @fmt: The format string to use
* @args: Arguments for the format string
*
- * The function returns the number of characters written
- * into @buf. Use vsnprintf() or vscnprintf() in order to avoid
+ * The return value is the number of characters written into @buf not including
+ * the trailing '\0'. Use vsnprintf() or vscnprintf() in order to avoid
* buffer overflows.
*
* If you're not already dealing with a va_list consider using sprintf().
@@ -3074,8 +3074,8 @@ EXPORT_SYMBOL(vsprintf);
* @fmt: The format string to use
* @...: Arguments for the format string
*
- * The function returns the number of characters written
- * into @buf. Use snprintf() or scnprintf() in order to avoid
+ * The return value is the number of characters written into @buf not including
+ * the trailing '\0'. Use snprintf() or scnprintf() in order to avoid
* buffer overflows.
*
* See the vsnprintf() documentation for format string extensions over C99.
--
2.51.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments
2025-11-03 9:09 [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments Thorsten Blum
@ 2025-11-03 9:42 ` Andy Shevchenko
2025-11-03 10:20 ` Thorsten Blum
2025-11-03 17:38 ` Petr Mladek
2025-11-03 17:45 ` Petr Mladek
2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2025-11-03 9:42 UTC (permalink / raw)
To: Thorsten Blum
Cc: Petr Mladek, Steven Rostedt, Rasmus Villemoes, Sergey Senozhatsky,
Andrew Morton, linux-kernel
On Mon, Nov 03, 2025 at 10:09:13AM +0100, Thorsten Blum wrote:
> Clarify that the return values of vsprintf() and sprintf() exclude the
> trailing NUL character.
I dunno if we need this clarification, but I'm not against it either, FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
if it helps somebody.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments
2025-11-03 9:42 ` Andy Shevchenko
@ 2025-11-03 10:20 ` Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2025-11-03 10:20 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Petr Mladek, Steven Rostedt, Rasmus Villemoes, Sergey Senozhatsky,
Andrew Morton, linux-kernel
On 3. Nov 2025, at 10:42, Andy Shevchenko wrote:
> On Mon, Nov 03, 2025 at 10:09:13AM +0100, Thorsten Blum wrote:
>> Clarify that the return values of vsprintf() and sprintf() exclude the
>> trailing NUL character.
>
> I dunno if we need this clarification, but I'm not against it either, FWIW,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> if it helps somebody.
Thanks. It would have helped me :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments
2025-11-03 9:09 [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments Thorsten Blum
2025-11-03 9:42 ` Andy Shevchenko
@ 2025-11-03 17:38 ` Petr Mladek
2025-11-03 17:45 ` Petr Mladek
2 siblings, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2025-11-03 17:38 UTC (permalink / raw)
To: Thorsten Blum
Cc: Steven Rostedt, Andy Shevchenko, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton, linux-kernel
On Mon 2025-11-03 10:09:13, Thorsten Blum wrote:
> Clarify that the return values of vsprintf() and sprintf() exclude the
> trailing NUL character.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Looks good to me:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
PS: I am sorry that the first email somehow slipped though the cracks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments
2025-11-03 9:09 [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments Thorsten Blum
2025-11-03 9:42 ` Andy Shevchenko
2025-11-03 17:38 ` Petr Mladek
@ 2025-11-03 17:45 ` Petr Mladek
2 siblings, 0 replies; 5+ messages in thread
From: Petr Mladek @ 2025-11-03 17:45 UTC (permalink / raw)
To: Thorsten Blum
Cc: Steven Rostedt, Andy Shevchenko, Rasmus Villemoes,
Sergey Senozhatsky, Andrew Morton, linux-kernel
On Mon 2025-11-03 10:09:13, Thorsten Blum wrote:
> Clarify that the return values of vsprintf() and sprintf() exclude the
> trailing NUL character.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
JFYI, the patch has been comitted into printk/linux.git,
branch for-6.19.
Best Regards,
Petr
PS: The patch was trivial so I was not waiting for any additional
feedback. And better to do not forget about the patch again ;-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-03 17:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 9:09 [PATCH RESEND] lib/vsprintf: Improve vsprintf + sprintf function comments Thorsten Blum
2025-11-03 9:42 ` Andy Shevchenko
2025-11-03 10:20 ` Thorsten Blum
2025-11-03 17:38 ` Petr Mladek
2025-11-03 17:45 ` Petr Mladek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.