diff options
Diffstat (limited to 'include/trace/events/printk.h')
| -rw-r--r-- | include/trace/events/printk.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h index c008bc99f9fa..13d405b2fd8b 100644 --- a/include/trace/events/printk.h +++ b/include/trace/events/printk.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef TRACE_SYSTEM #define TRACE_SYSTEM printk @@ -16,8 +17,16 @@ TRACE_EVENT(console, ), TP_fast_assign( - memcpy(__get_dynamic_array(msg), text, len); - ((char *)__get_dynamic_array(msg))[len] = 0; + /* + * Each trace entry is printed in a new line. + * If the msg finishes with '\n', cut it off + * to avoid blank lines in the trace. + */ + if ((len > 0) && (text[len-1] == '\n')) + len -= 1; + + memcpy(__get_str(msg), text, len); + __get_str(msg)[len] = 0; ), TP_printk("%s", __get_str(msg)) |
