提交 6a2cbc58 编写于 作者: Y Yun Zhou 提交者: Steven Rostedt (VMware)

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/20210625122453.5e2fe304@oasis.local.home/
Link: https://lkml.kernel.org/r/20210626032156.47889-2-yun.zhou@windriver.com

Cc: stable@vger.kernel.org
Fixes: 6d2289f3 ("tracing: Make trace_seq_putmem_hex() more robust")
Signed-off-by: NYun Zhou <yun.zhou@windriver.com>
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 d3b16034
...@@ -245,12 +245,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, ...@@ -245,12 +245,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
break; break;
/* j increments twice per loop */ /* j increments twice per loop */
len -= j / 2;
hex[j++] = ' '; hex[j++] = ' ';
seq_buf_putmem(s, hex, j); seq_buf_putmem(s, hex, j);
if (seq_buf_has_overflowed(s)) if (seq_buf_has_overflowed(s))
return -1; return -1;
len -= start_len;
data += start_len;
} }
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册