]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing: remove size parameter in __trace_puts()
authorSteven Rostedt <rostedt@goodmis.org>
Fri, 16 Jan 2026 04:25:08 +0000 (23:25 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 1 Feb 2026 00:16:05 +0000 (16:16 -0800)
The __trace_puts() function takes a string pointer and the size of the
string itself.  All users currently simply pass in the strlen() of the
string it is also passing in.  There's no reason to pass in the size.
Instead have the __trace_puts() function do the strlen() within the
function itself.

This fixes a header recursion issue where using strlen() in the macro
calling __trace_puts() requires adding #include <linux/string.h> in order
to use strlen().  Removing the use of strlen() from the header fixes the
recursion issue.

Link: https://lore.kernel.org/all/aUN8Hm377C5A0ILX@yury/
Link: https://lkml.kernel.org/r/20260116042510.241009-6-ynorov@nvidia.com
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/kernel.h
kernel/trace/trace.c
kernel/trace/trace.h

index 09850b26061ce9ad3cf6939ba9d85412c0039fa7..5838c419ed37905f38ab920d486c24a40025e140 100644 (file)
@@ -328,10 +328,10 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
        if (__builtin_constant_p(str))                                  \
                __trace_bputs(_THIS_IP_, trace_printk_fmt);             \
        else                                                            \
-               __trace_puts(_THIS_IP_, str, strlen(str));              \
+               __trace_puts(_THIS_IP_, str);                           \
 })
 extern int __trace_bputs(unsigned long ip, const char *str);
-extern int __trace_puts(unsigned long ip, const char *str, int size);
+extern int __trace_puts(unsigned long ip, const char *str);
 
 extern void trace_dump_stack(int skip);
 
index baec63134ab627d2e8c03d23b087746317cf2c42..e18005807395ff7067bfe9f4d0c7804fc48c5eb9 100644 (file)
@@ -1178,11 +1178,10 @@ EXPORT_SYMBOL_GPL(__trace_array_puts);
  * __trace_puts - write a constant string into the trace buffer.
  * @ip:           The address of the caller
  * @str:   The constant string to write
- * @size:  The size of the string.
  */
-int __trace_puts(unsigned long ip, const char *str, int size)
+int __trace_puts(unsigned long ip, const char *str)
 {
-       return __trace_array_puts(printk_trace, ip, str, size);
+       return __trace_array_puts(printk_trace, ip, str, strlen(str));
 }
 EXPORT_SYMBOL_GPL(__trace_puts);
 
@@ -1201,7 +1200,7 @@ int __trace_bputs(unsigned long ip, const char *str)
        int size = sizeof(struct bputs_entry);
 
        if (!printk_binsafe(tr))
-               return __trace_puts(ip, str, strlen(str));
+               return __trace_puts(ip, str);
 
        if (!(tr->trace_flags & TRACE_ITER(PRINTK)))
                return 0;
index b6d42fe061150290bbd6e6ebe5e5d1dcfca39ff6..de4e6713b84e6dcc2b76b22fb06aeb3bb263ffef 100644 (file)
@@ -2116,7 +2116,7 @@ extern void tracing_log_err(struct trace_array *tr,
  * about performance). The internal_trace_puts() is for such
  * a purpose.
  */
-#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str))
+#define internal_trace_puts(str) __trace_puts(_THIS_IP_, str)
 
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, id, tstruct, print)    \