summaryrefslogtreecommitdiff
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorSteven Rostedt (Google) <rostedt@goodmis.org>2023-12-12 16:44:44 +0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-12-13 06:07:22 +0300
commit60be76eeabb3d83858cc6577fc65c7d0f36ffd42 (patch)
treea9810f7cd2152a1c673266bc0af1d49136251f67 /kernel/trace/trace.h
parentb049525855fdd0024881c9b14b8fbec61c3f53d3 (diff)
downloadlinux-60be76eeabb3d83858cc6577fc65c7d0f36ffd42.tar.xz
tracing: Add size check when printing trace_marker output
If for some reason the trace_marker write does not have a nul byte for the string, it will overflow the print: trace_seq_printf(s, ": %s", field->buf); The field->buf could be missing the nul byte. To prevent overflow, add the max size that the buf can be by using the event size and the field location. int max = iter->ent_size - offsetof(struct print_entry, buf); trace_seq_printf(s, ": %*.s", max, field->buf); Link: https://lore.kernel.org/linux-trace-kernel/20231212084444.4619b8ce@gandalf.local.home Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.h')
0 files changed, 0 insertions, 0 deletions