Messages in this thread Patch in this message | | | Date | Thu, 19 Nov 2009 12:10:04 -0500 | From | Steven Rostedt <> | 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
| |