diff options
author | Yun Zhou <yun.zhou@windriver.com> | 2021-06-26 06:21:56 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 17:53:08 +0300 |
commit | 9ed57fc5a45b40348d8d362651fb47e9bb059f5a (patch) | |
tree | b77c29a8073546f1e3ea4cb03288c06cb51ec19a /lib | |
parent | c65755f595cd9f21da9569224c11c8a43a670ace (diff) | |
download | linux-9ed57fc5a45b40348d8d362651fb47e9bb059f5a.tar.xz |
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
commit 6a2cbc58d6c9d90cd74288cc497c2b45815bc064 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/20210625122453.5e2fe304@oasis.local.home/
Link: https://lkml.kernel.org/r/20210626032156.47889-2-yun.zhou@windriver.com
Cc: stable@vger.kernel.org
Fixes: 6d2289f3faa7 ("tracing: Make trace_seq_putmem_hex() more robust")
Signed-off-by: Yun Zhou <yun.zhou@windriver.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/seq_buf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/seq_buf.c b/lib/seq_buf.c index bd807f545a9d..b15dbb6f061a 100644 --- a/lib/seq_buf.c +++ b/lib/seq_buf.c @@ -242,12 +242,14 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, break; /* j increments twice per loop */ - len -= j / 2; hex[j++] = ' '; seq_buf_putmem(s, hex, j); if (seq_buf_has_overflowed(s)) return -1; + + len -= start_len; + data += start_len; } return 0; } |