All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: remove redundant test on nsigned
@ 2009-06-22 21:18 Roel Kluin
  2009-06-22 22:20 ` [PATCH] spufs: remove redundant test on unsigned Roel Kluin
  2009-06-23  1:05 ` [PATCH] ftrace: remove redundant test on nsigned Li Zefan
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* [PATCH] spufs: remove redundant test on unsigned
  2009-06-22 21:18 [PATCH] ftrace: remove redundant test on nsigned Roel Kluin
@ 2009-06-22 22:20 ` Roel Kluin
  2009-06-23  9:12   ` Jeremy Kerr
  2009-06-23  1:05 ` [PATCH] ftrace: remove redundant test on nsigned Li Zefan
  1 sibling, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-06-22 22:20 UTC (permalink / raw)
  To: jk; +Cc: linuxppc-dev, Andrew Morton

Unsigned `len' cannot be less than 0.

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

diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c
index d0b1f3f..8f799ee 100644
--- a/arch/powerpc/platforms/cell/spufs/sputrace.c
+++ b/arch/powerpc/platforms/cell/spufs/sputrace.c
@@ -73,7 +73,7 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
 {
 	int error = 0, cnt = 0;
 
-	if (!buf || len < 0)
+	if (!buf)
 		return -EINVAL;
 
 	while (cnt < len) {

^ permalink raw reply related	[flat|nested] 4+ 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-22 22:20 ` [PATCH] spufs: remove redundant test on unsigned Roel Kluin
@ 2009-06-23  1:05 ` Li Zefan
  1 sibling, 0 replies; 4+ 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] 4+ messages in thread

* Re: [PATCH] spufs: remove redundant test on unsigned
  2009-06-22 22:20 ` [PATCH] spufs: remove redundant test on unsigned Roel Kluin
@ 2009-06-23  9:12   ` Jeremy Kerr
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Kerr @ 2009-06-23  9:12 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linuxppc-dev, Andrew Morton

Roel,

> Unsigned `len' cannot be less than 0.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Thanks for the patch. However, we have a patch from Christoph Hellwig 
pending that will rework the sputrace code:

 http://patchwork.ozlabs.org/patch/28641/

It's currently queued in benh's tree, should be up soon.

Cheers,


Jeremy

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

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

Thread overview: 4+ 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-22 22:20 ` [PATCH] spufs: remove redundant test on unsigned Roel Kluin
2009-06-23  9:12   ` Jeremy Kerr
2009-06-23  1:05 ` [PATCH] ftrace: remove redundant test on nsigned Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.