tracing: Check keys for variable references in expressions too

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.

Link: http://lkml.kernel.org/r/e8c3d3d53db5ca90ceea5a46e5413103a6902fc7.1555597045.git.tom.zanussi@linux.intel.com

Cc: stable@vger.kernel.org
Fixes: 067fe038e70f6 ("tracing: Add variable reference handling to hist triggers")
Reported-by: Vincent Bernat <vincent@bernat.ch>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

authored by Tom Zanussi and committed by Steven Rostedt (VMware) c8d94a18 55267c88

+2 -2
+2 -2
kernel/trace/trace_events_hist.c
··· 59 59 C(NO_CLOSING_PAREN, "No closing paren found"), \ 60 60 C(SUBSYS_NOT_FOUND, "Missing subsystem"), \ 61 61 C(INVALID_SUBSYS_EVENT, "Invalid subsystem or event name"), \ 62 - C(INVALID_REF_KEY, "Using variable references as keys not supported"), \ 62 + C(INVALID_REF_KEY, "Using variable references in keys not supported"), \ 63 63 C(VAR_NOT_FOUND, "Couldn't find variable"), \ 64 64 C(FIELD_NOT_FOUND, "Couldn't find field"), 65 65 ··· 4506 4506 goto out; 4507 4507 } 4508 4508 4509 - if (hist_field->flags & HIST_FIELD_FL_VAR_REF) { 4509 + if (field_has_hist_vars(hist_field, 0)) { 4510 4510 hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str)); 4511 4511 destroy_hist_field(hist_field, 0); 4512 4512 ret = -EINVAL;