tracing: cleanup for tracing_trace_options_read()
PATCH 1/1 tracing: cleanup for tracing_trace_options_read()
'\n' is already appended, and what we need is just an extra space for the '\0'.
Signed-off-by Xiao Guangrong <[email protected]>
--- kernel/trace/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace.c +3 -3
@@ -2266,8 +2266,8 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, len +=3 ;/* "no" and newline */ } -/* +2 for \n and \0 */ - buf =kmalloc (len +2 ,GFP_KERNEL ); +/* +1 for \0 */ + buf =kmalloc (len +1 ,GFP_KERNEL );if (!buf) {mutex_unlock (&trace_types_lock);return -ENOMEM ;
@@ -2290,7 +2290,7 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, }mutex_unlock (&trace_types_lock); -WARN_ON (r >= len +2 ); +WARN_ON (r >= len +1 ); r =simple_read_from_buffer (ubuf, cnt, ppos, buf, r);
Signature · 1 line
1.6.1.2
Steven Rostedt
maintainerQuoted 2 lines · Xiao Guangrong
'\n' is already appended, and what we need is just an extra space for the '\0'.
Hi Xiao,
I'm going through old email (or email lost in the shuffle) and I came across this lost patch. I'll go ahead an apply it.
Thanks,
-- Steve
Quoted 34 lines
Signed-off-by Xiao Guangrong <[email protected]>--- kernel/trace/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)kernel/trace/trace.c +3
-3@@ -2266,8 +2266,8 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, len +=3 ;/* "no" and newline */ } -/* +2 for \n and \0 */ - buf =kmalloc (len +2 ,GFP_KERNEL ); +/* +1 for \0 */ + buf =kmalloc (len +1 ,GFP_KERNEL );if (!buf) {mutex_unlock (&trace_types_lock);return -ENOMEM ;@@ -2290,7 +2290,7 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, }mutex_unlock (&trace_types_lock); -WARN_ON (r >= len +2 ); +WARN_ON (r >= len +1 ); r =simple_read_from_buffer (ubuf, cnt, ppos, buf, r);Signature · 1 line
1.6.1.2
Commit-ID: ff4e9da2330beb8d64498a513d3f9694e941b01a Gitweb: http://git.kernel.org/tip/ff4e9da2330beb8d64498a513d3f9694e941b01a Author: Xiao Guangrong <[email protected]> AuthorDate: Mon, 22 Jun 2009 10:33:07 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Mon, 20 Jul 2009 12:02:09 -0400
tracing: cleanup for tracing_trace_options_read()
'\n' is already appended, and what we need is just an extra space for the '\0'.
Signed-off-by Xiao Guangrong <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by Steven Rostedt <[email protected]>
--- kernel/trace/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace.c +3 -3
@@ -2256,8 +2256,8 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, len +=3 ;/* "no" and newline */ } -/* +2 for \n and \0 */ - buf =kmalloc (len +2 ,GFP_KERNEL ); +/* +1 for \0 */ + buf =kmalloc (len +1 ,GFP_KERNEL );if (!buf) {mutex_unlock (&trace_types_lock);return -ENOMEM ;
@@ -2280,7 +2280,7 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf, }mutex_unlock (&trace_types_lock); -WARN_ON (r >= len +2 ); +WARN_ON (r >= len +1 ); r =simple_read_from_buffer (ubuf, cnt, ppos, buf, r);