]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tracing: Fix synth event printk format for str fields
authorDouglas Raillard <douglas.raillard@arm.com>
Tue, 25 Mar 2025 16:52:02 +0000 (16:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:37:43 +0000 (14:37 +0200)
commitfad52c9ae5bdd4e62cac5b71d3bc5dc6a0c3d810
tree6b28ebc9dde5f5d4a17e308f7c40a2664159cbd0
parentfc128e85cfc458cd975b28a0eefea79e857e2df7
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>
kernel/trace/trace_events_synth.c