diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-12-12 08:44:44 -0500 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-12-12 22:07:22 -0500 |
commit | 60be76eeabb3d83858cc6577fc65c7d0f36ffd42 (patch) | |
tree | a9810f7cd2152a1c673266bc0af1d49136251f67 /fs/read_write.c | |
parent | b049525855fdd0024881c9b14b8fbec61c3f53d3 (diff) |
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 'fs/read_write.c')
0 files changed, 0 insertions, 0 deletions