From: Divya Indi <divya.indi@oracle.com>
To: linux-kernel@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Cc: Divya Indi <divya.indi@oracle.com>,
Srinivas Eeda <srinivas.eeda@oracle.com>,
Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Subject: [PATCH 2/3] tracing: Adding additional NULL checks.
Date: Wed, 12 Jun 2019 09:34:18 -0700 [thread overview]
Message-ID: <1560357259-3497-3-git-send-email-divya.indi@oracle.com> (raw)
In-Reply-To: <1560357259-3497-2-git-send-email-divya.indi@oracle.com>
commit f45d1225adb0 ("tracing: Kernel access to Ftrace instances")
exported certain functions providing access to Ftrace instances from
other kernel components.
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.
--
1.8.3.1
next prev parent reply other threads:[~2019-06-12 16:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 16:34 [RFC][v2] Kernel Access to Ftrace Instances Divya Indi
2019-06-12 16:34 ` [PATCH 1/3] tracing: Relevant changes for kernel access to Ftrace instances Divya Indi
2019-06-12 16:34 ` Divya Indi [this message]
2019-06-12 16:34 ` [PATCH 3/3] tracing: Add 2 new funcs. " Divya Indi
2019-06-17 23:45 ` Steven Rostedt
2019-06-19 14:23 ` Divya Indi
2019-06-17 23:36 ` [PATCH 2/3] tracing: Adding additional NULL checks Steven Rostedt
2019-06-17 23:34 ` [PATCH 1/3] tracing: Relevant changes for kernel access to Ftrace instances Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2019-06-05 0:42 [RFC] Kernel Access " Divya Indi
2019-06-05 0:42 ` [PATCH 1/3] tracing: Relevant changes for kernel access " Divya Indi
2019-06-05 0:42 ` [PATCH 2/3] tracing: Adding additional NULL checks Divya Indi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560357259-3497-3-git-send-email-divya.indi@oracle.com \
--to=divya.indi@oracle.com \
--cc=aruna.ramakrishna@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=srinivas.eeda@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®