aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-02-20 20:37:32 -0500
committerSteven Rostedt <rostedt@goodmis.org>2012-02-21 11:08:13 -0500
commit5b34926114e39e12005031269613d2b13194aeba (patch)
tree40c0fd479d6e048ceec060d05e141de0a941b7b5
parente404b321dbb2d6e438522b7dce9c1d0c6a8c5275 (diff)
tracing: Don't use p->len field to determine output in __print_*() functions
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>
-rw-r--r--kernel/trace/trace_output.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 3efd718984fb..c5a01873567d 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,
319 319
320 /* check for left over flags */ 320 /* check for left over flags */
321 if (flags) { 321 if (flags) {
322 if (p->len && delim) 322 if (!first && delim)
323 trace_seq_puts(p, delim); 323 trace_seq_puts(p, delim);
324 trace_seq_printf(p, "0x%lx", flags); 324 trace_seq_printf(p, "0x%lx", flags);
325 } 325 }
@@ -346,7 +346,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
346 break; 346 break;
347 } 347 }
348 348
349 if (!p->len) 349 if (ret == (const char *)(p->buffer + p->len))
350 trace_seq_printf(p, "0x%lx", val); 350 trace_seq_printf(p, "0x%lx", val);
351 351
352 trace_seq_putc(p, 0); 352 trace_seq_putc(p, 0);
@@ -372,7 +372,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
372 break; 372 break;
373 } 373 }
374 374
375 if (!p->len) 375 if (ret == (const char *)(p->buffer + p->len))
376 trace_seq_printf(p, "0x%llx", val); 376 trace_seq_printf(p, "0x%llx", val);
377 377
378 trace_seq_putc(p, 0); 378 trace_seq_putc(p, 0);