Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755979AbZGBG4U (ORCPT ); Thu, 2 Jul 2009 02:56:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752551AbZGBG4F (ORCPT ); Thu, 2 Jul 2009 02:56:05 -0400 Received: from hera.kernel.org ([140.211.167.34]:53535 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbZGBG4E (ORCPT ); Thu, 2 Jul 2009 02:56:04 -0400 Date: Thu, 2 Jul 2009 06:54:58 GMT From: tip-bot for Xiao Guangrong To: linux-tip-commits@vger.kernel.org Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com, penberg@cs.helsinki.fi, eduard.munteanu@linux360.ro, xiaoguangrong@cn.fujitsu.com, fweisbec@gmail.com, rostedt@goodmis.org, tglx@linutronix.de, mingo@elte.hu Reply-To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, penberg@cs.helsinki.fi, eduard.munteanu@linux360.ro, xiaoguangrong@cn.fujitsu.com, fweisbec@gmail.com, rostedt@goodmis.org, tglx@linutronix.de, mingo@elte.hu In-Reply-To: <4A4B2351.5010300@cn.fujitsu.com> References: <4A4B2351.5010300@cn.fujitsu.com> Subject: [tip:tracing/urgent] tracing: Fix trace_print_seq() Message-ID: Git-Commit-ID: e1af3aec3e2e7d21d4b3054323779d478c19d907 X-Mailer: tip-git-log-daemon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Thu, 02 Jul 2009 06:54:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1990 Lines: 61 Commit-ID: e1af3aec3e2e7d21d4b3054323779d478c19d907 Gitweb: http://git.kernel.org/tip/e1af3aec3e2e7d21d4b3054323779d478c19d907 Author: Xiao Guangrong AuthorDate: Wed, 1 Jul 2009 16:50:25 +0800 Committer: Ingo Molnar CommitDate: Thu, 2 Jul 2009 08:51:13 +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 Acked-by: Frederic Weisbecker Acked-by: Pekka Enberg Acked-by: Eduard - Gabriel Munteanu Cc: Steven Rostedt LKML-Reference: <4A4B2351.5010300@cn.fujitsu.com> Signed-off-by: Ingo Molnar --- 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/