mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
tools lib traceevent: Handle NULL comm name
It is possible that a pid has no associated comm attached to it, although it can still be passed to pevent_register_comm(). But if comm is NULL, it will cause strdup() to segfault. To prevent this from happening, if comm is NULL use the default "<...>" name for the pid. Signed-off-by: Josef Bacik <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/p/[email protected] Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
18425f13a0
commit
deab6f55a2
1 changed files with 4 additions and 1 deletions
|
|
@ -304,7 +304,10 @@ int pevent_register_comm(struct pevent *pevent, const char *comm, int pid)
|
|||
if (!item)
|
||||
return -1;
|
||||
|
||||
item->comm = strdup(comm);
|
||||
if (comm)
|
||||
item->comm = strdup(comm);
|
||||
else
|
||||
item->comm = strdup("<...>");
|
||||
if (!item->comm) {
|
||||
free(item);
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue