Skip to content

Commit adace44

Browse files
lyentingrostedt
authored andcommitted
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>
1 parent 7c339fb commit adace44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/trace/trace_output.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,11 @@ trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len,
221221
const char *ret = trace_seq_buffer_ptr(p);
222222
const char *fmt = concatenate ? "%*phN" : "%*ph";
223223

224-
for (i = 0; i < buf_len; i += 16)
224+
for (i = 0; i < buf_len; i += 16) {
225+
if (!concatenate && i != 0)
226+
trace_seq_putc(p, ' ');
225227
trace_seq_printf(p, fmt, min(buf_len - i, 16), &buf[i]);
228+
}
226229
trace_seq_putc(p, 0);
227230

228231
return ret;

0 commit comments

Comments
 (0)