From: Josef Bacik <jbacik@fb.com>
To: <linux-kernel@vger.kernel.org>, <rostedt@goodmis.org>
Subject: [PATCH] trace-cmd: handle NULL comm name in .dat file
Date: Thu, 26 Jun 2014 09:22:12 -0700 [thread overview]
Message-ID: <1403799732-30308-1-git-send-email-jbacik@fb.com> (raw)
Sometimes the comm field in the trace.dat file can be empty which means that the
event parsing stuff can pass a NULL into pevent_register_comm. To fix this just
check if we are NULL and generate a bogus comm name for that PID. This keeps us
from segfaulting. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
event-parse.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/event-parse.c b/event-parse.c
index 18b3587..00304fe 100644
--- a/event-parse.c
+++ b/event-parse.c
@@ -303,7 +303,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;
--
2.0.0
next reply other threads:[~2014-06-26 16:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 16:22 Josef Bacik [this message]
2014-06-27 20:21 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403799732-30308-1-git-send-email-jbacik@fb.com \
--to=jbacik@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®