Thread (38 messages) 38 messages, 7 authors, 1d ago

Re: [PATCH v4 05/11] seq_buf: Add seq_buf_strlen()

From: Kees Cook <kees@kernel.org>
Date: 2026-10-05 11:22:15
Also in: bpf, linux-doc, linux-hardening, linux-trace-kernel, linuxppc-dev, lkml, nvdimm

On Sun, Oct 04, 2026 at 11:34:30AM +0300, Andy Shevchenko wrote:
On Sun, Oct 04, 2026 at 12:26:39AM -0700, Kees Cook wrote:
quoted
I'd rather not make all 0-len strings return the .data segment's const
"" string...
Good point. Perhaps then to add a short note to the kernel doc,
so we won't see patches based on the suggestion like I gave?
Yeah, reasonable. :) For v5 I've added this to seq_buf_str()'s kernel-doc:

 * A zero-sized seq_buf has nowhere to put a NUL, so the empty string
 * is returned instead of writing to @s->buffer. Any other seq_buf
 * returns @s->buffer, even when it holds an empty string, so callers
 * always get their own buffer back.

-Kees

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help