Re: [PATCH] builtin: implement __builtin_strlen() for constants

Chris Li <[email protected]>
Newsgroups org.kernel.vger.linux-sparse,org.kernel.vger.linux-media
Message-ID <CACePvbVG2KrGQq4cNKV=wbO5h=jp3M0RO1SdfX8kV4OukjPG8A@mail.gmail.com>
Thanks,

Will apply with Linus' fix up.

Chris

On Thu, Oct 16, 2025 at 1:29 AM Dan Carpenter <[email protected]> wrote:
>
> On Wed, Oct 15, 2025 at 08:13:51AM -0700, Linus Torvalds wrote:
> > So you should add a
> >
> >     #include <string.h>
> >
> > at the top, and do something like
> >
> > -       expr->value = arg->string->length - 1;
> > +       expr->value = strlen(arg->string->data);
> >
> > in there instead, because constant strings can have embedded NUL characters.
> >
> >            Linus
>
> Ah.  Thanks.
>
> regards,
> dan carpenter
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.