Message ID | 20230216144520.07f4aebf@rorschach.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | 8261ef2eb35fce689a82d346b25e945e16bcb9d3 |
Headers | show |
Series | PATCH] tracing: Add BUILD_BUG() to make sure stacktrace fits in strings | expand |
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index f21e42ddba69..6cef1def1da5 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -3119,6 +3119,9 @@ static inline void __update_field_vars(struct tracing_map_elt *elt, unsigned int i, j, var_idx; u64 var_val; + /* Make sure stacktrace can fit in the string variable length */ + BUILD_BUG_ON((HIST_STACKTRACE_DEPTH + 1) * sizeof(long) >= STR_VAR_LEN_MAX); + for (i = 0, j = field_var_str_start; i < n_field_vars; i++) { struct field_var *field_var = field_vars[i]; struct hist_field *var = field_var->var;