[tip:tracing/urgent] tracing: Fix trace_print_seq()

From: tip-bot for Xiao Guangrong
Date: Wed Jul 01 2009 - 10:43:39 EST


Commit-ID: 393ab9a2a6cf958c9549e35bd88c03b9b3eae64e
Gitweb: http://git.kernel.org/tip/393ab9a2a6cf958c9549e35bd88c03b9b3eae64e
Author: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
AuthorDate: Wed, 1 Jul 2009 16:50:25 +0800
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Wed, 1 Jul 2009 16:41:31 +0200

tracing: Fix trace_print_seq()

We will lose something if trace_seq->buffer[0] is 0, because the copy length
is calculated by strlen() in seq_puts(), so using seq_write() instead of
seq_puts().

There have a example:
after reboot:

# echo kmemtrace > current_tracer
# echo 0 > options/kmem_minimalistic
# cat trace
# tracer: kmemtrace
#
#

Nothing is exported, because the first byte of trace_seq->buffer[ ]
is KMEMTRACE_USER_ALLOC.

( the value of KMEMTRACE_USER_ALLOC is zero, seeing
kmemtrace_print_alloc_user() in kernel/trace/kmemtrace.c)

Signed-off-by: Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx>
Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Acked-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
LKML-Reference: <4A4B2351.5010300@xxxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


---
kernel/trace/trace_output.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 7938f3a..e0c2545 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -27,8 +27,7 @@ void trace_print_seq(struct seq_file *m, struct trace_seq *s)
{
int len = s->len >= PAGE_SIZE ? PAGE_SIZE - 1 : s->len;

- s->buffer[len] = 0;
- seq_puts(m, s->buffer);
+ seq_write(m, s->buffer, len);

trace_seq_init(s);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/