public inbox for linux-sparse@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-sparse@vger.kernel.org,
	Ricardo Ribalda <ribalda@chromium.org>,
	Kees Cook <kees@kernel.org>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] builtin: implement __builtin_strlen() for constants
Date: Thu, 16 Oct 2025 11:29:23 +0300	[thread overview]
Message-ID: <aPCs46Sno0a4dsyK@stanley.mountain> (raw)
In-Reply-To: <CAHk-=wgKcf_dP0_7yTqL+JKc03mhFgqFHkN7jXLUrOy=WjWZUA@mail.gmail.com>

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

  reply	other threads:[~2025-10-16  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15 13:08 [PATCH] builtin: implement __builtin_strlen() for constants Dan Carpenter
2025-10-15 15:13 ` Linus Torvalds
2025-10-16  8:29   ` Dan Carpenter [this message]
2025-10-16 12:05     ` Chris Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aPCs46Sno0a4dsyK@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=kees@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ribalda@chromium.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox