Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: remove size parameter in __trace_puts()

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>

authored by

Steven Rostedt and committed by
Andrew Morton
86e685ff 269586d6

+6 -7
+2 -2
include/linux/kernel.h
··· 328 328 if (__builtin_constant_p(str)) \ 329 329 __trace_bputs(_THIS_IP_, trace_printk_fmt); \ 330 330 else \ 331 - __trace_puts(_THIS_IP_, str, strlen(str)); \ 331 + __trace_puts(_THIS_IP_, str); \ 332 332 }) 333 333 extern int __trace_bputs(unsigned long ip, const char *str); 334 - extern int __trace_puts(unsigned long ip, const char *str, int size); 334 + extern int __trace_puts(unsigned long ip, const char *str); 335 335 336 336 extern void trace_dump_stack(int skip); 337 337
+3 -4
kernel/trace/trace.c
··· 1178 1178 * __trace_puts - write a constant string into the trace buffer. 1179 1179 * @ip: The address of the caller 1180 1180 * @str: The constant string to write 1181 - * @size: The size of the string. 1182 1181 */ 1183 - int __trace_puts(unsigned long ip, const char *str, int size) 1182 + int __trace_puts(unsigned long ip, const char *str) 1184 1183 { 1185 - return __trace_array_puts(printk_trace, ip, str, size); 1184 + return __trace_array_puts(printk_trace, ip, str, strlen(str)); 1186 1185 } 1187 1186 EXPORT_SYMBOL_GPL(__trace_puts); 1188 1187 ··· 1200 1201 int size = sizeof(struct bputs_entry); 1201 1202 1202 1203 if (!printk_binsafe(tr)) 1203 - return __trace_puts(ip, str, strlen(str)); 1204 + return __trace_puts(ip, str); 1204 1205 1205 1206 if (!(tr->trace_flags & TRACE_ITER(PRINTK))) 1206 1207 return 0;
+1 -1
kernel/trace/trace.h
··· 2116 2116 * about performance). The internal_trace_puts() is for such 2117 2117 * a purpose. 2118 2118 */ 2119 - #define internal_trace_puts(str) __trace_puts(_THIS_IP_, str, strlen(str)) 2119 + #define internal_trace_puts(str) __trace_puts(_THIS_IP_, str) 2120 2120 2121 2121 #undef FTRACE_ENTRY 2122 2122 #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \