All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Andrew Vagin <avagin@openvz.org>
Subject: [PATCH 2/9] tracing: Dont use p->len field to determine output in __print_*() functions
Date: Wed, 22 Feb 2012 09:40:38 -0500	[thread overview]
Message-ID: <20120222144209.470203447@goodmis.org> (raw)
In-Reply-To: 20120222144036.824378742@goodmis.org

[-- Attachment #1: Type: text/plain, Size: 1577 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

If more than one __print_*() function is used in a tracepoint
(__print_flags(), __print_symbols(), etc), then the temp seq buffer will
not be zero on entry. Using the temp seq buffer's length to know if
data has been printed or not in the current function is incorrect and
may produce incorrect results.

Currently, no in-tree tracepoint causes this bug, but new ones may
be created.

Cc: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_output.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 3efd718..c5a0187 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -319,7 +319,7 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
 
 	/* check for left over flags */
 	if (flags) {
-		if (p->len && delim)
+		if (!first && delim)
 			trace_seq_puts(p, delim);
 		trace_seq_printf(p, "0x%lx", flags);
 	}
@@ -346,7 +346,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
 		break;
 	}
 
-	if (!p->len)
+	if (ret == (const char *)(p->buffer + p->len))
 		trace_seq_printf(p, "0x%lx", val);
 		
 	trace_seq_putc(p, 0);
@@ -372,7 +372,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
 		break;
 	}
 
-	if (!p->len)
+	if (ret == (const char *)(p->buffer + p->len))
 		trace_seq_printf(p, "0x%llx", val);
 
 	trace_seq_putc(p, 0);
-- 
1.7.8.3



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2012-02-22 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-22 14:40 [PATCH 0/9] [GIT PULL] perf/tracing: fixes and add function trace to perf Steven Rostedt
2012-02-22 14:40 ` [PATCH 1/9] tracing: Dont print an extra separator of flags Steven Rostedt
2012-02-22 14:40 ` Steven Rostedt [this message]
2012-02-22 14:40 ` [PATCH 3/9] ftrace: Add enable/disable ftrace_ops control interface Steven Rostedt
2012-02-22 14:40 ` [PATCH 4/9] ftrace, perf: Add open/close tracepoint perf registration actions Steven Rostedt
2012-02-22 14:40 ` [PATCH 5/9] ftrace, perf: Add add/del " Steven Rostedt
2012-02-22 14:40 ` [PATCH 6/9] ftrace: Add FTRACE_ENTRY_REG macro to allow event registration Steven Rostedt
2012-02-22 14:40 ` [PATCH 7/9] ftrace, perf: Add support to use function tracepoint in perf Steven Rostedt
2012-02-22 14:40 ` [PATCH 8/9] ftrace: Allow to specify filter field type for ftrace events Steven Rostedt
2012-02-22 14:40 ` [PATCH 9/9] ftrace, perf: Add filter support for function trace event Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120222144209.470203447@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.