Skip to contentSkip to conversation

tracing, function tracer: Clean up strstrip() usage

tip:tracing/core tip-bot for Ingo Molnar 2 participants 2 messages Nov 23, 2009 – Nov 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  457dc928f586f3f4b930206965e6db270034e97e
Gitweb:     http://git.kernel.org/tip/457dc928f586f3f4b930206965e6db270034e97e
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 23 Nov 2009 11:03:28 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 23 Nov 2009 11:04:07 +0100

tracing, function tracer: Clean up strstrip() usage

Clean up strstrip() usage - which also addresses this build warning:

kernel/trace/ftrace.c: In function 'ftrace_pid_write':
kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result

Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>

---
 kernel/trace/ftrace.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +4 -5
index 7f9b51e..1dc101d 100644
@@ -2985,7 +2985,7 @@ static ssize_t
 ftrace_pid_write(struct file *filp, const char __user *ubuf,
 		   size_t cnt, loff_t *ppos)
 {
-	char buf[64];
+	char buf[64], *tmp;
 	long val;
 	int ret;
 
@@ -3001,11 +3001,11 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
 	 * Allow "echo > set_ftrace_pid" or "echo -n '' > set_ftrace_pid"
 	 * to clean the filter quietly.
 	 */
-	strstrip(buf);
-	if (strlen(buf) == 0)
+	tmp = strstrip(buf);
+	if (strlen(tmp) == 0)
 		return 1;
 
-	ret = strict_strtol(buf, 10, &val);
+	ret = strict_strtol(tmp, 10, &val);
 	if (ret < 0)
 		return ret;
 
@@ -3391,4 +3391,3 @@ void ftrace_graph_stop(void)
 	ftrace_stop();
 }
 #endif
-
maintainer
#1 lore raw

Ingo,

Not sure if you noticed, but this was the first change in the git pull I sent earlier. It was from Javier Martinez Canillas which he first posted back on October 31st.

-- Steve

Quoted 59 lines · tip-bot for Ingo Molnar
Commit-ID:  457dc928f586f3f4b930206965e6db270034e97e
Gitweb:     http://git.kernel.org/tip/457dc928f586f3f4b930206965e6db270034e97e
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 23 Nov 2009 11:03:28 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 23 Nov 2009 11:04:07 +0100

tracing, function tracer: Clean up strstrip() usage

Clean up strstrip() usage - which also addresses this build warning:

kernel/trace/ftrace.c: In function 'ftrace_pid_write':
kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result

Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
LKML-Reference: <new-submission>

---
 kernel/trace/ftrace.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
kernel/trace/ftrace.c +4 -5
index 7f9b51e..1dc101d 100644
@@ -2985,7 +2985,7 @@ static ssize_t
 ftrace_pid_write(struct file *filp, const char __user *ubuf,
 		   size_t cnt, loff_t *ppos)
 {
-	char buf[64];
+	char buf[64], *tmp;
 	long val;
 	int ret;
 
@@ -3001,11 +3001,11 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
 	 * Allow "echo > set_ftrace_pid" or "echo -n '' > set_ftrace_pid"
 	 * to clean the filter quietly.
 	 */
-	strstrip(buf);
-	if (strlen(buf) == 0)
+	tmp = strstrip(buf);
+	if (strlen(tmp) == 0)
 		return 1;
 
-	ret = strict_strtol(buf, 10, &val);
+	ret = strict_strtol(tmp, 10, &val);
 	if (ret < 0)
 		return ret;
 
@@ -3391,4 +3391,3 @@ void ftrace_graph_stop(void)
 	ftrace_stop();
 }
 #endif
-