From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Josef Bacik <jbacik@fb.com>
Subject: [PATCH 1/9] tools lib traceevent: Handle NULL comm name
Date: Tue, 24 Mar 2015 09:57:49 -0400 [thread overview]
Message-ID: <20150324135922.549965495@goodmis.org> (raw)
In-Reply-To: 20150324135748.506437888@goodmis.org
[-- Attachment #1: 0001-tools-lib-traceevent-Handle-NULL-comm-name.patch --]
[-- Type: text/plain, Size: 1085 bytes --]
From: Josef Bacik <jbacik@fb.com>
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.
Link: http://lkml.kernel.org/p/1403799732-30308-1-git-send-email-jbacik@fb.com
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
tools/lib/traceevent/event-parse.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d7c37a7d9255..fdcb89be5e67 100644
--- 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;
--
2.1.4
next prev parent reply other threads:[~2015-03-24 13:59 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 13:57 [PATCH 0/9] tools lib traceevent: Pulling in updates from trace-cmd Steven Rostedt
2015-03-24 13:57 ` Steven Rostedt [this message]
2015-03-24 16:33 ` [tip:perf/core] tools lib traceevent: Handle NULL comm name tip-bot for Josef Bacik
2015-03-24 13:57 ` [PATCH 2/9] tools lib traceevent: Copy trace_clock and free it Steven Rostedt
2015-03-24 15:14 ` Arnaldo Carvalho de Melo
2015-03-24 15:43 ` Steven Rostedt
2015-03-24 16:33 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 13:57 ` [PATCH 3/9] tools lib traceevent: Handle %z in bprint format Steven Rostedt
2015-03-24 16:33 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 13:57 ` [PATCH 4/9] tools lib traceevent: Add pevent_data_pid_from_comm() Steven Rostedt
2015-03-24 15:16 ` Arnaldo Carvalho de Melo
2015-03-24 16:34 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 13:57 ` [PATCH 5/9] tools lib traceevent: Fix whitespace error Steven Rostedt
2015-03-24 15:19 ` Arnaldo Carvalho de Melo
2015-03-24 15:37 ` Steven Rostedt
2015-03-24 13:57 ` [PATCH 6/9] tools lib traceevent: Make plugin options either string or boolean Steven Rostedt
2015-03-24 16:34 ` [tip:perf/core] " tip-bot for Steven Rostedt
2015-03-24 13:57 ` [PATCH 7/9] tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING Steven Rostedt
2015-03-24 16:34 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 13:57 ` [PATCH 8/9] tools lib traceevent: Add way to find sub buffer boundary Steven Rostedt
2015-03-24 16:35 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 13:57 ` [PATCH 9/9] tools lib traceevent: Free filter tokens in process_filter() Steven Rostedt
2015-03-24 16:35 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2015-03-24 14:57 ` [PATCH 0/9] tools lib traceevent: Pulling in updates from trace-cmd Arnaldo Carvalho de Melo
2015-03-24 15:04 ` Steven Rostedt
2015-03-24 15:25 ` Arnaldo Carvalho de Melo
2015-03-24 15:26 ` Arnaldo Carvalho de Melo
2015-03-24 15:44 ` Steven Rostedt
2015-03-24 15:45 ` Steven Rostedt
2015-03-24 15:51 ` Arnaldo Carvalho de Melo
2015-03-24 16:19 ` 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=20150324135922.549965495@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=jbacik@fb.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.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