projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
18425f1
)
tools lib traceevent: Handle NULL comm name
author
Josef Bacik
<
[email protected]
>
Tue, 24 Mar 2015 13:57:49 +0000
(09:57 -0400)
committer
Arnaldo Carvalho de Melo
<
[email protected]
>
Tue, 24 Mar 2015 15:10:26 +0000
(12:10 -0300)
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]
>
tools/lib/traceevent/event-parse.c
patch
|
blob
|
history
diff --git
a/tools/lib/traceevent/event-parse.c
b/tools/lib/traceevent/event-parse.c
index 8e5e4f6137bb6b1242d5f1db3fa4e000c6f9e830..31d4e7da191c44175eef2cc3311b95fa19591f89 100644
(file)
--- a/
tools/lib/traceevent/event-parse.c
+++ b/
tools/lib/traceevent/event-parse.c
@@
-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;