public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: remove redundant test on nsigned
@ 2009-06-22 21:18 Roel Kluin
  2009-06-23  1:05 ` Li Zefan
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-06-22 21:18 UTC (permalink / raw)
  To: rostedt; +Cc: LKML, Andrew Morton

Unsigned `cnt' cannot be less than 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Or should it be `if (!cnt || cnt > MAX)' and what should MAX be then?

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index aa08be6..b83f030 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -204,7 +204,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
 	char *buf;
 	char ch;
 
-	if (!cnt || cnt < 0)
+	if (!cnt)
 		return 0;
 
 	ret = tracing_update_buffers();

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

* Re: [PATCH] ftrace: remove redundant test on nsigned
  2009-06-22 21:18 [PATCH] ftrace: remove redundant test on nsigned Roel Kluin
@ 2009-06-23  1:05 ` Li Zefan
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2009-06-23  1:05 UTC (permalink / raw)
  To: Roel Kluin; +Cc: rostedt, LKML, Andrew Morton

Roel Kluin wrote:
> Unsigned `cnt' cannot be less than 0.
> 

The patch is fine, but there's a typo in the title s/nsigned/unsigned

> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Or should it be `if (!cnt || cnt > MAX)' and what should MAX be then?
> 

No, note there is another check:

	if (cnt > EVENT_BUF_SIZE)
		cnt = EVENT_BUF_SIZE;

> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index aa08be6..b83f030 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -204,7 +204,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
>  	char *buf;
>  	char ch;
>  
> -	if (!cnt || cnt < 0)
> +	if (!cnt)
>  		return 0;
>  
>  	ret = tracing_update_buffers();
> --

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

end of thread, other threads:[~2009-06-23  1:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 21:18 [PATCH] ftrace: remove redundant test on nsigned Roel Kluin
2009-06-23  1:05 ` Li Zefan

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