|
@@ -164,16 +164,15 @@ void parse_ftrace_printk(struct tep_handle *pevent,
|
|
|
void parse_saved_cmdline(struct tep_handle *pevent,
|
|
|
char *file, unsigned int size __maybe_unused)
|
|
|
{
|
|
|
- char *comm;
|
|
|
+ char comm[17]; /* Max comm length in the kernel is 16. */
|
|
|
char *line;
|
|
|
char *next = NULL;
|
|
|
int pid;
|
|
|
|
|
|
line = strtok_r(file, "\n", &next);
|
|
|
while (line) {
|
|
|
- sscanf(line, "%d %ms", &pid, &comm);
|
|
|
- tep_register_comm(pevent, comm, pid);
|
|
|
- free(comm);
|
|
|
+ if (sscanf(line, "%d %16s", &pid, comm) == 2)
|
|
|
+ tep_register_comm(pevent, comm, pid);
|
|
|
line = strtok_r(NULL, "\n", &next);
|
|
|
}
|
|
|
}
|