Skip to content

Commit dbfb0b2

Browse files
zhouyun1306gregkh
authored andcommitted
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
commit 6a2cbc5 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 460f1f8 commit dbfb0b2

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
@@ -243,12 +243,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
243243
break;
244244

245245
/* j increments twice per loop */
246-
len -= j / 2;
247246
hex[j++] = ' ';
248247

249248
seq_buf_putmem(s, hex, j);
250249
if (seq_buf_has_overflowed(s))
251250
return -1;
251+
252+
len -= start_len;
253+
data += start_len;
252254
}
253255
return 0;
254256
}

0 commit comments

Comments
 (0)