linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bookjovi@gmail.com
To: bookjovi@gmail.com, acme@ghostprotocols.net, mingo@elte.hu,
	a.p.zijlstra@chello.nl, paulus@samba.org
Cc: linux-kernel@vger.kernel.org, root <root@localhost.localdomain>
Subject: [PATCH] perf: fix coredump caused by introduce of probe module option
Date: Mon, 25 Jul 2011 22:08:08 +0800	[thread overview]
Message-ID: <1311602888-2389-1-git-send-email-bookjovi@gmail.com> (raw)

From: root <root@localhost.localdomain>

perf will coredump if user don't give "-m" option in probe command,
this patch fix it.

[root@localhost perf]# ./perf probe --add='PROBE'
Segmentation fault (core dumped)

Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
---
 tools/perf/util/probe-event.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index b82d54f..1c7bfa5 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1820,11 +1820,15 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
 		ret = -ENOMEM;
 		goto error;
 	}
-	tev->point.module = strdup(module);
-	if (tev->point.module == NULL) {
-		ret = -ENOMEM;
-		goto error;
+
+	if (module) {
+		tev->point.module = strdup(module);
+		if (tev->point.module == NULL) {
+			ret = -ENOMEM;
+			goto error;
+		}
 	}
+
 	tev->point.offset = pev->point.offset;
 	tev->point.retprobe = pev->point.retprobe;
 	tev->nargs = pev->nargs;
-- 
1.6.5.2


             reply	other threads:[~2011-07-30  3:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 14:08 bookjovi [this message]
2011-08-08  3:01 ` [PATCH] perf: fix coredump caused by introduce of probe module option Jovi Zhang
2011-08-08 14:41   ` Arnaldo Carvalho de Melo
2011-08-10  8:25 ` [tip:perf/urgent] perf probe: Fix coredump introduced by " tip-bot for Jovi Zhang

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=1311602888-2389-1-git-send-email-bookjovi@gmail.com \
    --to=bookjovi@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=root@localhost.localdomain \
    /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;
as well as URLs for NNTP newsgroup(s).