Skip to content

Commit 4d38328

Browse files
douglas-raillard-armrostedt
authored andcommitted
tracing: Fix synth event printk format for str fields
The printk format for synth event uses "%.*s" to print string fields, but then only passes the pointer part as var arg. Replace %.*s with %s as the C string is guaranteed to be null-terminated. The output in print fmt should never have been updated as __get_str() handles the string limit because it can access the length of the string in the string meta data that is saved in the ring buffer. Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Fixes: 8db4d6b ("tracing: Change synthetic event string format to limit printed length") Link: https://lore.kernel.org/20250325165202.541088-1-douglas.raillard@arm.com Signed-off-by: Douglas Raillard <douglas.raillard@arm.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 8eb1518 commit 4d38328

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace_events_synth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static const char *synth_field_fmt(char *type)
305305
else if (strcmp(type, "gfp_t") == 0)
306306
fmt = "%x";
307307
else if (synth_field_is_string(type))
308-
fmt = "%.*s";
308+
fmt = "%s";
309309
else if (synth_field_is_stack(type))
310310
fmt = "%s";
311311

0 commit comments

Comments
 (0)