lkml.org 
[lkml]   [2016]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH perf/core v11 02/20] perf-probe: Fix to add NULL check for strndup
Date
Fix to add a NULL check for strndup when parsing
probe trace command.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
Changes in v10:
- Splited from "perf probe: Allow wildcard for cached events"
---
tools/perf/util/probe-event.c | 4 ++++
1 file changed, 4 insertions(+)

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];
\
 
 \ /
  Last update: 2016-06-15 06:01    [W:0.159 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site