public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: fix trace_print_seq()
@ 2009-07-01  8:50 Xiao Guangrong
  2009-07-01 14:01 ` Frederic Weisbecker
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Xiao Guangrong @ 2009-07-01  8:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Eduard - Gabriel Munteanu, Frederic Weisbecker, Steven Rostedt,
	LKML

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@cn.fujitsu.com>
---
 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);
 }
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-07-02  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01  8:50 [PATCH] tracing: fix trace_print_seq() Xiao Guangrong
2009-07-01 14:01 ` Frederic Weisbecker
2009-07-02  5:57   ` Li Zefan
2009-07-01 14:06 ` [tip:tracing/urgent] tracing: Fix trace_print_seq() tip-bot for Xiao Guangrong
2009-07-01 14:15   ` Pekka Enberg
2009-07-01 14:42 ` tip-bot for Xiao Guangrong
2009-07-02  6:54 ` tip-bot for Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox