lkml.org 
[lkml]   [2009]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/4] [PATCH 1/4] tracing: Fix strstrip usage in set_ftrace_pid
From: Javier Martinez Canillas <martinez.javier@gmail.com>

The code in writing to set_ftrace_pid crops off whitespace before and
after the passed in string. But the usage of strstrip is incorrect,
and does not do the intended job.

# echo ' 3431 ' > /debug/tracing/set_ftrace_pid
-bash: echo: write error: Invalid argument

With this fix, the above line now succeeds.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
LKML-Reference: <1256965563.4278.7.camel@laptop>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7f9b51e..b29ff29 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2987,6 +2987,7 @@ ftrace_pid_write(struct file *filp, const char __user *ubuf,
{
char buf[64];
long val;
+ char *bufstr;
int ret;

if (cnt >= sizeof(buf))
@@ -3001,11 +3002,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)
+ bufstr = strstrip(buf);
+ if (strlen(bufstr) == 0)
return 1;

- ret = strict_strtol(buf, 10, &val);
+ ret = strict_strtol(bufstr, 10, &val);
if (ret < 0)
return ret;

--
1.6.5



\
 
 \ /
  Last update: 2009-11-19 18:13    [W:0.048 / U:12.656 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site