lkml.org 
[lkml]   [2019]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] tracing: Adding additional NULL checks.
On Wed, 12 Jun 2019 09:34:18 -0700
Divya Indi <divya.indi@oracle.com> wrote:

> commit f45d1225adb0 ("tracing: Kernel access to Ftrace instances")
> exported certain functions providing access to Ftrace instances from
> other kernel components.

I'm fine with the patch, the above statement is hard to understand.

-- Steve

> Adding some additional NULL checks to ensure safe usage by the users.
>
> Signed-off-by: Divya Indi <divya.indi@oracle.com>
> ---
> kernel/trace/trace.c | 3 +++
> kernel/trace/trace_events.c | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 1c80521..a60dc13 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3205,6 +3205,9 @@ int trace_array_printk(struct trace_array *tr,
> if (!(global_trace.trace_flags & TRACE_ITER_PRINTK))
> return 0;
>
> + if (!tr)
> + return -EINVAL;
> +
> va_start(ap, fmt);
> ret = trace_array_vprintk(tr, ip, fmt, ap);
> va_end(ap);
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index b6b4618..445b059 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -800,6 +800,8 @@ int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
> char *event = NULL, *sub = NULL, *match;
> int ret;
>
> + if (!tr)
> + return -ENODEV;
> /*
> * The buf format can be <subsystem>:<event-name>
> * *:<event-name> means any event by that name.

\
 
 \ /
  Last update: 2019-06-18 01:38    [W:0.123 / U:0.248 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site