Steven Rostedt (Google) 60be76eeab 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>
2023-12-12 22:07:22 -05:00
..
2023-11-15 04:18:31 +01:00
2023-11-15 04:02:25 +01:00
2023-10-30 18:01:41 -10:00
2023-11-03 15:44:25 -10:00
2023-11-08 09:47:52 -08:00
2023-10-30 20:13:17 -10:00
2023-03-24 11:01:29 +01:00
2023-10-19 11:02:48 +02:00
2023-10-04 10:41:56 -07:00
2023-08-30 09:16:56 -07:00
2023-10-09 16:59:47 +10:00
2023-06-28 15:51:08 -07:00
2023-09-19 13:21:33 -07:00
2023-10-18 14:34:15 -07:00
2023-10-30 17:56:53 -10:00
2023-10-04 10:41:57 -07:00
2023-11-01 15:28:33 -10:00
2023-11-01 15:28:33 -10:00
2023-08-15 15:26:17 -07:00
2023-10-11 08:46:01 -07:00