[PATCH v5 0/3] tracing: bound histogram expression strings

From: Pengpeng Hou

Date: Thu Jun 11 2026 - 02:00:20 EST


This v5 starts a new thread and splits the previous expr_str() update
into the preparatory lifetime cleanup, the ERR_PTR() conversion, and the
bounded seq_buf conversion.

The series is based on trace/for-next at 8970865b788e
("Merge trace/for-next").

Patch 1 converts the expr_str() output buffer to __free(kfree).
Patch 2 converts expr_str() failures from NULL to ERR_PTR().
Patch 3 replaces the raw strcat() expression construction with seq_buf
and returns -E2BIG when the rendered expression would exceed
MAX_FILTER_STR_VAL.

Changes since v4:
https://lore.kernel.org/all/20260521022817.38453-1-pengpeng@xxxxxxxxxxx/
- start a new thread for the new patch revision
- split the __free(kfree) conversion and ERR_PTR() conversion into
separate patches as requested
- simplify the unary-minus seq_buf conversion with a single
seq_buf_printf(&s, "-(%s)", subexpr) and keep subexpr manually freed
- keep the seq_buf include unchanged because trace/for-next already has
<linux/seq_buf.h> in this file

Pengpeng Hou (3):
tracing: Use __free() for expr_str() buffer
tracing: Return ERR_PTR() from expr_str()
tracing: Bound histogram expression strings with seq_buf

kernel/trace/trace_events_hist.c | 92 ++++++++++++++++++++------------
1 file changed, 57 insertions(+), 35 deletions(-)

--
2.50.1 (Apple Git-155)