public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing: cleanup for tracing_trace_options_read()
@ 2009-06-22  2:33 Xiao Guangrong
  2009-07-20 15:59 ` Steven Rostedt
  2009-08-05  8:19 ` [tip:tracing/core] " tip-bot for Xiao Guangrong
  0 siblings, 2 replies; 3+ messages in thread
From: Xiao Guangrong @ 2009-06-22  2:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, LKML

'\n' is already appended, and what we need is just an extra
space for the '\0'.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 kernel/trace/trace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 076fa6f..4c3f856 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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);
 
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: cleanup for tracing_trace_options_read()
  2009-06-22  2:33 [PATCH] tracing: cleanup for tracing_trace_options_read() Xiao Guangrong
@ 2009-07-20 15:59 ` Steven Rostedt
  2009-08-05  8:19 ` [tip:tracing/core] " tip-bot for Xiao Guangrong
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2009-07-20 15:59 UTC (permalink / raw)
  To: Xiao Guangrong; +Cc: Ingo Molnar, Frederic Weisbecker, LKML


On Mon, 22 Jun 2009, Xiao Guangrong wrote:

> '\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


> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
>  kernel/trace/trace.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 076fa6f..4c3f856 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -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);
>  
> -- 
> 1.6.1.2
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:tracing/core] tracing: cleanup for tracing_trace_options_read()
  2009-06-22  2:33 [PATCH] tracing: cleanup for tracing_trace_options_read() Xiao Guangrong
  2009-07-20 15:59 ` Steven Rostedt
@ 2009-08-05  8:19 ` tip-bot for Xiao Guangrong
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Xiao Guangrong @ 2009-08-05  8:19 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, rostedt, xiaoguangrong, tglx

Commit-ID:  ff4e9da2330beb8d64498a513d3f9694e941b01a
Gitweb:     http://git.kernel.org/tip/ff4e9da2330beb8d64498a513d3f9694e941b01a
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Mon, 22 Jun 2009 10:33:07 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
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 <xiaoguangrong@cn.fujitsu.com>
LKML-Reference: <4A3EED63.3090908@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>


---
 kernel/trace/trace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e30e6b1..38a4a3e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-08-05  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22  2:33 [PATCH] tracing: cleanup for tracing_trace_options_read() Xiao Guangrong
2009-07-20 15:59 ` Steven Rostedt
2009-08-05  8:19 ` [tip:tracing/core] " tip-bot for Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox