History

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

Tom Zanussi committed 7 years ago

Commit c8d94a11 parent 55267c81 file · +2 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_events_hist.c+2−2
@@ -59,7 +59,7 @@ · 58 unmodified lines
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, · 4440 unmodified lines
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;