[PATCH] tracing: Keep index within map_pid_to_cmdline[]

From: Roel Kluin
Date: Tue Jun 16 2009 - 12:01:22 EST


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;
}
--
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/