Log errors to the tracing/events/error_log for nonexistent fields and modifiers specified in hist triggers. Also screen out variable references, which shouldn't be looked up as fields. Signed-off-by: Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx> Reported-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> --- kernel/trace/trace_events_hist.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 08424ff..d223fd6 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -2461,6 +2461,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data, else if (strcmp(modifier, "usecs") == 0) *flags |= HIST_FIELD_FL_TIMESTAMP_USECS; else { + log_err("Invalid field modifier: %s", modifier); field = ERR_PTR(-EINVAL); goto out; } @@ -2476,6 +2477,7 @@ static struct hist_field *parse_var_ref(struct hist_trigger_data *hist_data, else { field = trace_find_event_field(file->event_call, field_name); if (!field || !field->size) { + log_err("Couldn't find field: %s", field_name); field = ERR_PTR(-EINVAL); goto out; } @@ -2553,6 +2555,11 @@ static struct hist_field *parse_atom(struct hist_trigger_data *hist_data, } else str = s; + if (is_var_ref(str)) { + ret = -EINVAL; + goto out; + } + field = parse_field(hist_data, file, str, flags); if (IS_ERR(field)) { ret = PTR_ERR(field); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html