Skip to contentSkip to conversation

tracing: Keep index within map_pid_to_cmdline[]

PATCH In review Roel Kluin 2 participants 2 messages Jun 16, 2009 Tracing

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 tracing: Keep index within map_pid_to_cmdline[]

Ensure that index `pid' remains within array map_pid_to_cmdline[]

---

kernel/trace/trace.c +1 -1
index 8acd9b8..f359e9e 100644
@@ -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;
 	}
maintainer
#1 lore raw
Quoted 9 lines · Roel Kluin

Ensure that index `pid' remains within array map_pid_to_cmdline[]

---

kernel/trace/trace.c +0 -0
index 8acd9b8..f359e9e 100644

kernel/trace/trace.c void trace_find_cmdline(int pid, char comm[]) · line 809

Quoted 8 lines
kernel/trace/trace.c +1 -1
@@ -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