From: Tom Zanussi <zanussi@kernel.org>
To: rostedt@goodmis.org
Cc: vincent@bernat.ch, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] tracing: Check keys for variable references in expressions too
Date: Thu, 8 Nov 2018 08:41:49 -0600 [thread overview]
Message-ID: <7fbe5b861d20215f41351d3fc8e70a8447be0000.1541687121.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1541687121.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1541687121.git.tom.zanussi@linux.intel.com>
From: Tom Zanussi <tom.zanussi@linux.intel.com>
There's an existing check for variable references in keys, but it
doesn't go far enough. It checks whether a key field is a variable
reference but doesn't check whether it's an expression containing
variable references, which can cause the same problems for callers.
Use the existing field_has_hist_vars() function rather than a direct
top-level flag check to catch all possible variable references.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Reported-by: Vincent Bernat <vincent@bernat.ch>
---
kernel/trace/trace_events_hist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 3795207a48a0..bf993a9a65ec 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3970,8 +3970,8 @@ static int create_key_field(struct hist_trigger_data *hist_data,
goto out;
}
- if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
- hist_err("Using variable references as keys not supported: ", field_str);
+ if (field_has_hist_vars(hist_field, 0)) {
+ hist_err("Using variable references in keys not supported: ", field_str);
destroy_hist_field(hist_field, 0);
ret = -EINVAL;
goto out;
--
2.14.1
next prev parent reply other threads:[~2018-11-08 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 14:41 [PATCH 0/2] tracing: Fix NULL pointer bug in hist key expressions Tom Zanussi
2018-11-08 14:41 ` [PATCH 1/2] tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts Tom Zanussi
2018-11-08 14:41 ` Tom Zanussi [this message]
2018-11-08 18:45 ` [PATCH 0/2] tracing: Fix NULL pointer bug in hist key expressions Steven Rostedt
2018-11-08 19:12 ` Tom Zanussi
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=7fbe5b861d20215f41351d3fc8e70a8447be0000.1541687121.git.tom.zanussi@linux.intel.com \
--to=zanussi@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=vincent@bernat.ch \
/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;
as well as URLs for NNTP newsgroup(s).