Messages in this thread Patch in this message | | | From | bookjovi@gmail ... | Subject | [PATCH] perf: fix coredump caused by introduce of probe module option | Date | Mon, 25 Jul 2011 22:08:08 +0800 |
| |
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
| |