Re: [PATCH v5 06/12] seq_buf: Add seq_buf_strlen()

From: Steven Rostedt

Date: Thu Oct 22 2026 - 20:38:29 EST


On Thu, 22 Oct 2026 23:02:36 +0200
Alejandro Colomar <alx+linux-hardening@xxxxxxxxxx> wrote:

> >
> > I rather not increase its size. It is embedded in the trace_seq.
>
> The size shouldn't change:
>
> alx@debian:~/tmp$ cat seq_buf_size_comparison.c
> #include <stddef.h>
> #include <stdio.h>
>
> struct seq_buf {
> char *buffer;
> size_t size;
> size_t len;
> };
>
> struct alx_seq_buf {
> char *buffer;
> char *p;
> char *end;
> };

OK, I was thinking you were adding another pointer.

>
> int
> main(void)
> {
> printf("%zu\n", sizeof(struct seq_buf));
> printf("%zu\n", sizeof(struct alx_seq_buf));
> }
> alx@debian:~/tmp$ gcc -Wall -Wextra seq_buf_size_comparison.c
> alx@debian:~/tmp$ ./a.out
> 24
> 24
>
> size_t and pointers should always have the same size, so this doesn't
> change the size.
>
> Am I missing something?
>
>
> Cheers,
> Alex
>
> > Yes the seq_buf code can be complex, but it's in one location where it can
> > be highly tested and verified. The point of seq_buf is to do the complexity
> > so that other places in the kernel doesn't need to.

We could look into updating it to pointers later, but right now I
rather keep what we have. Let's focus first on the new stuff. It's not
that hard to validate.

-- Steve