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

Dan Carpenter <[email protected]>
Newsgroups org.kernel.vger.linux-sparse,org.kernel.vger.linux-media
Message-ID <[email protected]>
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.