Re: [PATCH] tracing: Keep index within map_pid_to_cmdline[]
From: Steven Rostedt
Date: Tue Jun 16 2009 - 12:13:47 EST
On Tue, 16 Jun 2009, Roel Kluin wrote:
> Ensure that index `pid' remains within array map_pid_to_cmdline[]
>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 8acd9b8..f359e9e 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -803,7 +803,7 @@ void trace_find_cmdline(int pid, char comm[])
> return;
> }
>
> - if (pid > PID_MAX_DEFAULT) {
> + if (pid > PID_MAX_DEFAULT || pid < 0) {
> strcpy(comm, "<...>");
> return;
> }
Did you ever hit a case where pid was < 0? Or is this just a "safety
patch"?
-- Steve
--
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/