summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorKen Lin <lyenting@google.com>2023-04-26 06:22:57 +0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-04-26 16:10:02 +0300
commitadace4408252cc1c9913958d71e81a688af90a30 (patch)
treeade7d7361676812a4b56adbc9c7f180d51c4c4c2 /kernel
parent7c339fb4d8577792378136c15fde773cfb863cb8 (diff)
downloadlinux-adace4408252cc1c9913958d71e81a688af90a30.tar.xz
tracing: Add missing spaces in trace_print_hex_seq()
If the buffer length is larger than 16 and concatenate is set to false, there would be missing spaces every 16 bytes. Example: Before: c5 11 10 50 05 4d 31 40 00 40 00 40 00 4d 31 4000 40 00 After: c5 11 10 50 05 4d 31 40 00 40 00 40 00 4d 31 40 00 40 00 Link: https://lore.kernel.org/linux-trace-kernel/20230426032257.3157247-1-lyenting@google.com Signed-off-by: Ken Lin <lyenting@google.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_output.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 952cc8aa8e59..15f05faaae44 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -221,8 +221,11 @@ trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
const char *ret = trace_seq_buffer_ptr(p);
const char *fmt = concatenate ? "%*phN" : "%*ph";
- for (i = 0; i < buf_len; i += 16)
+ for (i = 0; i < buf_len; i += 16) {
+ if (!concatenate && i != 0)
+ trace_seq_putc(p, ' ');
trace_seq_printf(p, fmt, min(buf_len - i, 16), &buf[i]);
+ }
trace_seq_putc(p, 0);
return ret;