On Mon, Sep 21, 2026 at 05:46:47AM -0400, Steven Rostedt wrote:
> That is, make this a separate patch to introduce a
> "seq_buf_terminate()" function as there's several places in the kernel
> that could replace seq_buf_str() with it.

My first reaction was that this would be redundant, since both
seq_buf_str() and seq_buf_strlen() terminate as a side effect and either
can be called for that alone. Then I went looking for the call sites
you meant, and yeah, it's pretty clear it's needed. Otherwise we're
depending on a side-effect and throwing away a return value:

        /* Terminate synthetic_name with a NUL. */
        seq_buf_str(&s);

And various other examples...

  kernel/trace/trace_events_hist.c:2992
  kernel/trace/trace_events_hist.c:3110
  kernel/trace/trace_events.c:4909
  kernel/trace/trace_events.c:4938
  kernel/bpf/diagnostics.c:354
  kernel/bpf/diagnostics.c:634
  kernel/bpf/diagnostics.c:638

I'll add it for v3.

-Kees

-- 
Kees Cook

Reply via email to