linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Petr Mladek <pmladek@suse.cz>
Subject: [for-next][PATCH 16/18] tracing: Do not use return values of trace_seq_printf() in syscall tracing
Date: Wed, 19 Nov 2014 18:26:48 -0500	[thread overview]
Message-ID: <20141119232712.054790840@goodmis.org> (raw)
In-Reply-To: 20141119232632.737569526@goodmis.org

[-- Attachment #1: 0016-tracing-Do-not-use-return-values-of-trace_seq_printf.patch --]
[-- Type: text/plain, Size: 3127 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

The functions trace_seq_printf() and friends will not be returning values
soon and will be void functions. To know if they succeeded or not, the
functions trace_seq_has_overflowed() and trace_handle_return() should be
used instead.

Reviewed-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_syscalls.c | 47 +++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 28 deletions(-)

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 4dc8b79c5f75..a72f3d8d813e 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -114,7 +114,7 @@ print_syscall_enter(struct trace_iterator *iter, int flags,
 	struct trace_entry *ent = iter->ent;
 	struct syscall_trace_enter *trace;
 	struct syscall_metadata *entry;
-	int i, ret, syscall;
+	int i, syscall;
 
 	trace = (typeof(trace))ent;
 	syscall = trace->nr;
@@ -128,35 +128,28 @@ print_syscall_enter(struct trace_iterator *iter, int flags,
 		goto end;
 	}
 
-	ret = trace_seq_printf(s, "%s(", entry->name);
-	if (!ret)
-		return TRACE_TYPE_PARTIAL_LINE;
+	trace_seq_printf(s, "%s(", entry->name);
 
 	for (i = 0; i < entry->nb_args; i++) {
+
+		if (trace_seq_has_overflowed(s))
+			goto end;
+
 		/* parameter types */
-		if (trace_flags & TRACE_ITER_VERBOSE) {
-			ret = trace_seq_printf(s, "%s ", entry->types[i]);
-			if (!ret)
-				return TRACE_TYPE_PARTIAL_LINE;
-		}
+		if (trace_flags & TRACE_ITER_VERBOSE)
+			trace_seq_printf(s, "%s ", entry->types[i]);
+
 		/* parameter values */
-		ret = trace_seq_printf(s, "%s: %lx%s", entry->args[i],
-				       trace->args[i],
-				       i == entry->nb_args - 1 ? "" : ", ");
-		if (!ret)
-			return TRACE_TYPE_PARTIAL_LINE;
+		trace_seq_printf(s, "%s: %lx%s", entry->args[i],
+				 trace->args[i],
+				 i == entry->nb_args - 1 ? "" : ", ");
 	}
 
-	ret = trace_seq_putc(s, ')');
-	if (!ret)
-		return TRACE_TYPE_PARTIAL_LINE;
-
+	trace_seq_putc(s, ')');
 end:
-	ret =  trace_seq_putc(s, '\n');
-	if (!ret)
-		return TRACE_TYPE_PARTIAL_LINE;
+	trace_seq_putc(s, '\n');
 
-	return TRACE_TYPE_HANDLED;
+	return trace_handle_return(s);
 }
 
 static enum print_line_t
@@ -168,7 +161,6 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
 	struct syscall_trace_exit *trace;
 	int syscall;
 	struct syscall_metadata *entry;
-	int ret;
 
 	trace = (typeof(trace))ent;
 	syscall = trace->nr;
@@ -176,7 +168,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
 
 	if (!entry) {
 		trace_seq_putc(s, '\n');
-		return TRACE_TYPE_HANDLED;
+		goto out;
 	}
 
 	if (entry->exit_event->event.type != ent->type) {
@@ -184,12 +176,11 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
 		return TRACE_TYPE_UNHANDLED;
 	}
 
-	ret = trace_seq_printf(s, "%s -> 0x%lx\n", entry->name,
+	trace_seq_printf(s, "%s -> 0x%lx\n", entry->name,
 				trace->ret);
-	if (!ret)
-		return TRACE_TYPE_PARTIAL_LINE;
 
-	return TRACE_TYPE_HANDLED;
+ out:
+	return trace_handle_return(s);
 }
 
 extern char *__bad_type_size(void);
-- 
2.1.1



  parent reply	other threads:[~2014-11-19 23:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 23:26 [for-next][PATCH 00/18] tracing: Fixes and trace-seq updates Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 01/18] tracing: Fix race of function probes counting Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 02/18] ftrace/x86: Add frames pointers to trampoline as necessary Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 03/18] ftrace/x86/extable: Add is_ftrace_trampoline() function Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 04/18] x86/kvm/tracing: Use helper function trace_seq_buffer_ptr() Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 05/18] RAS/tracing: Use trace_seq_buffer_ptr() helper instead of open coded Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 06/18] tracing: Fix trace_seq_bitmask() to start at current position Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 07/18] tracing: Add trace_seq_has_overflowed() and trace_handle_return() Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 08/18] blktrace/tracing: Use trace_seq_has_overflowed() helper function Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 09/18] ring-buffer: Remove check of trace_seq_{puts,printf}() return values Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 10/18] tracing: Have branch tracer use trace_handle_return() helper function Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 11/18] tracing: Have function_graph use trace_seq_has_overflowed() Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 12/18] kprobes/tracing: Use trace_seq_has_overflowed() for overflow checks Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 13/18] tracing: Do not check return values of trace_seq_p*() for mmio tracer Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 14/18] tracing/probes: Do not use return value of trace_seq_printf() Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 15/18] tracing/uprobes: Do not use return values " Steven Rostedt
2014-11-19 23:26 ` Steven Rostedt [this message]
2014-11-19 23:26 ` [for-next][PATCH 17/18] tracing: Remove return values of most trace_seq_*() functions Steven Rostedt
2014-11-19 23:26 ` [for-next][PATCH 18/18] tracing: Fix return value of ftrace_raw_output_prep() 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=20141119232712.054790840@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pmladek@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).