summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Raillard <douglas.raillard@arm.com>2025-03-25 16:52:02 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:33:43 +0200
commite9564aa7b841e3fdc0d503dda979ab94608864b1 (patch)
tree4f2caf487a10668ecb7d8eeec9f73e9963c59d8e
parentbb9616ba5bd17fe83df08d03f09db6cf49679500 (diff)
downloadlinux-e9564aa7b841e3fdc0d503dda979ab94608864b1.tar.gz
linux-e9564aa7b841e3fdc0d503dda979ab94608864b1.tar.bz2
linux-e9564aa7b841e3fdc0d503dda979ab94608864b1.zip
tracing: Fix synth event printk format for str fields
commit 4d38328eb442dc06aec4350fd9594ffa6488af02 upstream. 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: 8db4d6bfbbf92 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/trace/trace_events_synth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index bcf3bd7cff82..12c97c2f6fae 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -312,7 +312,7 @@ static const char *synth_field_fmt(char *type)
else if (strcmp(type, "gfp_t") == 0)
fmt = "%x";
else if (synth_field_is_string(type))
- fmt = "%.*s";
+ fmt = "%s";
else if (synth_field_is_stack(type))
fmt = "%s";