public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Christoph Hellwig <hch@lst.de>,
	Javier Martinez Canillas <martinez.javier@gmail.com>
Subject: [PATCH 1/4] [PATCH 1/4] tracing: Fix strstrip usage in set_ftrace_pid
Date: Thu, 19 Nov 2009 12:10:04 -0500	[thread overview]
Message-ID: <20091119171106.365522470@goodmis.org> (raw)
In-Reply-To: 20091119171003.929771398@goodmis.org

[-- Attachment #1: 0001-tracing-Fix-strstrip-usage-in-set_ftrace_pid.patch --]
[-- Type: text/plain, Size: 1378 bytes --]

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



  reply	other threads:[~2009-11-19 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-19 17:10 [PATCH 0/4] [GIT PULL] tracing: Fix and trace event space savings Steven Rostedt
2009-11-19 17:10 ` Steven Rostedt [this message]
2009-11-19 17:10 ` [PATCH 2/4] [PATCH 2/4] tracing: Create new TRACE_EVENT_TEMPLATE Steven Rostedt
2009-11-20  8:06   ` Li Zefan
2009-11-19 17:10 ` [PATCH 3/4] [PATCH 3/4] tracing: Create new DEFINE_EVENT_PRINT Steven Rostedt
2009-11-19 17:10 ` [PATCH 4/4] [PATCH 4/4] tracing: Convert some sched trace events to DEFINE_EVENT and _PRINT 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=20091119171106.365522470@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=fweisbec@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martinez.javier@gmail.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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