Skip to content

Commit c8d94a1

Browse files
tzanussirostedt
authored andcommitted
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: [email protected] Fixes: 067fe03 ("tracing: Add variable reference handling to hist triggers") Reported-by: Vincent Bernat <[email protected]> Signed-off-by: Tom Zanussi <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 55267c8 commit c8d94a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
C(NO_CLOSING_PAREN, "No closing paren found"), \
6060
C(SUBSYS_NOT_FOUND, "Missing subsystem"), \
6161
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"), \
6363
C(VAR_NOT_FOUND, "Couldn't find variable"), \
6464
C(FIELD_NOT_FOUND, "Couldn't find field"),
6565

@@ -4506,7 +4506,7 @@ static int create_key_field(struct hist_trigger_data *hist_data,
45064506
goto out;
45074507
}
45084508

4509-
if (hist_field->flags & HIST_FIELD_FL_VAR_REF) {
4509+
if (field_has_hist_vars(hist_field, 0)) {
45104510
hist_err(tr, HIST_ERR_INVALID_REF_KEY, errpos(field_str));
45114511
destroy_hist_field(hist_field, 0);
45124512
ret = -EINVAL;

0 commit comments

Comments
 (0)