Commit cbef6b99 authored by Divya Indi's avatar Divya Indi Committed by Greg Kroah-Hartman

tracing: Adding NULL checks for trace_array descriptor pointer

[ Upstream commit 953ae45a ]

As part of commit f45d1225 ("tracing: Kernel access to Ftrace
instances") we exported certain functions. Here, we are adding some additional
NULL checks to ensure safe usage by users of these APIs.

Link: http://lkml.kernel.org/r/1565805327-579-4-git-send-email-divya.indi@oracle.comSigned-off-by: default avatarDivya Indi <divya.indi@oracle.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b55eddf9
...@@ -3037,6 +3037,9 @@ int trace_array_printk(struct trace_array *tr, ...@@ -3037,6 +3037,9 @@ int trace_array_printk(struct trace_array *tr,
if (!(global_trace.trace_flags & TRACE_ITER_PRINTK)) if (!(global_trace.trace_flags & TRACE_ITER_PRINTK))
return 0; return 0;
if (!tr)
return -ENOENT;
va_start(ap, fmt); va_start(ap, fmt);
ret = trace_array_vprintk(tr, ip, fmt, ap); ret = trace_array_vprintk(tr, ip, fmt, ap);
va_end(ap); va_end(ap);
......
...@@ -800,6 +800,8 @@ static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set) ...@@ -800,6 +800,8 @@ static int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
char *event = NULL, *sub = NULL, *match; char *event = NULL, *sub = NULL, *match;
int ret; int ret;
if (!tr)
return -ENOENT;
/* /*
* The buf format can be <subsystem>:<event-name> * The buf format can be <subsystem>:<event-name>
* *:<event-name> means any event by that name. * *:<event-name> means any event by that name.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment