diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2016-06-08 09:29:21 (GMT) |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-14 12:29:54 (GMT) |
commit | 844faa4bcddc5d321311003ea3af9d808371c48e (patch) | |
tree | c1868330783e90352f7bf70f761738370829be28 /tools | |
parent | 2a1ef032cfccd8c92f32b86615a0b0151a7cd86f (diff) | |
download | linux-844faa4bcddc5d321311003ea3af9d808371c48e.tar.xz |
perf probe: Fix to add NULL check for strndup
Fix to add a NULL check for strndup when parsing probe trace command.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160608092920.3116.63319.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 74401a2..7ae3dd1 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1603,6 +1603,10 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev) p = strchr(argv[1], ':'); if (p) { tp->module = strndup(argv[1], p - argv[1]); + if (!tp->module) { + ret = -ENOMEM; + goto out; + } p++; } else p = argv[1]; |