Re: [PATCH] ftrace: remove redundant test on nsigned

From: Li Zefan
Date: Mon Jun 22 2009 - 21:03:33 EST


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@xxxxxxxxx>
> ---
> 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();
> --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/