Skip to content

Commit 6a2cbc5

Browse files
zhouyun1306rostedt
authored andcommitted
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
Since the raw memory 'data' does not go forward, it will dump repeated data if the data length is more than 8. If we want to dump longer data blocks, we need to repeatedly call macro SEQ_PUT_HEX_FIELD. I think it is a bit redundant, and multiple function calls also affect the performance. Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 6d2289f ("tracing: Make trace_seq_putmem_hex() more robust") Signed-off-by: Yun Zhou <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent d3b1603 commit 6a2cbc5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/seq_buf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
245245
break;
246246

247247
/* j increments twice per loop */
248-
len -= j / 2;
249248
hex[j++] = ' ';
250249

251250
seq_buf_putmem(s, hex, j);
252251
if (seq_buf_has_overflowed(s))
253252
return -1;
253+
254+
len -= start_len;
255+
data += start_len;
254256
}
255257
return 0;
256258
}

0 commit comments

Comments
 (0)