aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-11-03 10:09:13 +0100
committerPetr Mladek <pmladek@suse.com>2025-11-03 18:39:29 +0100
commit2e448748146dd37b178925f17d3c1f47298a7542 (patch)
tree57694a1466f55a1f529d0019045b4e8108034626
parent67e1b0052f6bb82be84e30a5af7d27f29533a83b (diff)
downloadtip-2e448748146dd37b178925f17d3c1f47298a7542.tar.gz
lib/vsprintf: Improve vsprintf + sprintf function comments
Clarify that the return values of vsprintf() and sprintf() exclude the trailing NUL character. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Petr Mladek <pmladek@suse.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20251103090913.2066-2-thorsten.blum@linux.dev Signed-off-by: Petr Mladek <pmladek@suse.com>
-rw-r--r--lib/vsprintf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index eb0cb11d0d126f..e49f350ee549de 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.