builtin.c | 1 + 1 file changed, 1 insertion(+)
From: Daniel Gomez <da.gomez@samsung.com>
Commit ae83f3b72621 ("module: Add compile-time check for embedded
NUL characters") in the Linux kernel added static assert checks for
__builtin_strlen() inside MODULE_INFO() macros. But sparse does not mark
the result as CEF_SET_ICE during evaluation, making these assertions
fail with:
error: static assertion failed: "MODULE_INFO(...) contains embedded
NUL byte"
Fix by marking __builtin_strlen() as an integer constant expression at
eval time. This matches other builtins like __builtin_constant_p() or
__builtin_safe_p().
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Discussion:
https://lore.kernel.org/all/aTc9s210am0YqMV4@agluck-desk3/
---
builtin.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/builtin.c b/builtin.c
index 9149c43d..7573abf8 100644
--- a/builtin.c
+++ b/builtin.c
@@ -616,6 +616,7 @@ static int expand_strlen(struct expression *expr, int cost)
}
static struct symbol_op strlen_op = {
+ .evaluate = evaluate_to_int_const_expr,
.expand = expand_strlen,
};
---
base-commit: fbdde3127b83e6d09e0ba808d7925dd84407f3c6
change-id: 20260219-fix-builtin-strlen-08eb3a02609b
Best regards,
--
Daniel Gomez <da.gomez@samsung.com>
On 2026-02-19 17:10, Daniel Gomez wrote:
> From: Daniel Gomez <da.gomez@samsung.com>
>
> Commit ae83f3b72621 ("module: Add compile-time check for embedded
> NUL characters") in the Linux kernel added static assert checks for
> __builtin_strlen() inside MODULE_INFO() macros. But sparse does not mark
> the result as CEF_SET_ICE during evaluation, making these assertions
> fail with:
>
> error: static assertion failed: "MODULE_INFO(...) contains embedded
> NUL byte"
>
> Fix by marking __builtin_strlen() as an integer constant expression at
> eval time. This matches other builtins like __builtin_constant_p() or
> __builtin_safe_p().
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: "Luck, Tony" <tony.luck@intel.com>
Reported-by: Eric Biggers <ebiggers@kernel.org>
Hi Daniel,
On Thu, Feb 19, 2026 at 8:11 AM Daniel Gomez <da.gomez@kernel.org> wrote:
>
> From: Daniel Gomez <da.gomez@samsung.com>
>
> Commit ae83f3b72621 ("module: Add compile-time check for embedded
> NUL characters") in the Linux kernel added static assert checks for
> __builtin_strlen() inside MODULE_INFO() macros. But sparse does not mark
> the result as CEF_SET_ICE during evaluation, making these assertions
> fail with:
>
> error: static assertion failed: "MODULE_INFO(...) contains embedded
> NUL byte"
>
> Fix by marking __builtin_strlen() as an integer constant expression at
> eval time. This matches other builtins like __builtin_constant_p() or
> __builtin_safe_p().
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
> Discussion:
> https://lore.kernel.org/all/aTc9s210am0YqMV4@agluck-desk3/
It looks like Al had a more complete fix for this issue, but I guess
it never ended up in the sparse repo?
https://lore.kernel.org/all/aUV7kyjxlijuy5sC@agluck-desk3/
Sami
On 2026-02-19 08:41, Sami Tolvanen wrote:
> Hi Daniel,
>
> On Thu, Feb 19, 2026 at 8:11 AM Daniel Gomez <da.gomez@kernel.org> wrote:
> >
> > From: Daniel Gomez <da.gomez@samsung.com>
> >
> > Commit ae83f3b72621 ("module: Add compile-time check for embedded
> > NUL characters") in the Linux kernel added static assert checks for
> > __builtin_strlen() inside MODULE_INFO() macros. But sparse does not mark
> > the result as CEF_SET_ICE during evaluation, making these assertions
> > fail with:
> >
> > error: static assertion failed: "MODULE_INFO(...) contains embedded
> > NUL byte"
> >
> > Fix by marking __builtin_strlen() as an integer constant expression at
> > eval time. This matches other builtins like __builtin_constant_p() or
> > __builtin_safe_p().
> >
> > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> > ---
> > Discussion:
> > https://lore.kernel.org/all/aTc9s210am0YqMV4@agluck-desk3/
>
> It looks like Al had a more complete fix for this issue, but I guess
> it never ended up in the sparse repo?
>
> https://lore.kernel.org/all/aUV7kyjxlijuy5sC@agluck-desk3/
>
> Sami
Chris, Al,
Can you please take a look? If Al patch is the correct approach, any
chance you can send it and fix this?
On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > Chris, Al, > > Can you please take a look? If Al patch is the correct approach, any > chance you can send it and fix this? I am asking in another thread should I pull Al's git repo instead. There are a few good commits there. Chris
On Thu, Feb 19, 2026 at 09:06:23AM -0800, Chris Li wrote: > On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > > > Can you please take a look? If Al patch is the correct approach, any > > chance you can send it and fix this? > > I am asking in another thread should I pull Al's git repo instead. > There are a few good commits there. Please, pull Al's work, My colleagues and I use his version of sparse for a few weeks without noticing any downsides. -- With Best Regards, Andy Shevchenko
On Thu, Feb 19, 2026 at 11:20 AM Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > > On Thu, Feb 19, 2026 at 09:06:23AM -0800, Chris Li wrote: > > On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > > > > > Can you please take a look? If Al patch is the correct approach, any > > > chance you can send it and fix this? > > > > I am asking in another thread should I pull Al's git repo instead. > > There are a few good commits there. > > Please, pull Al's work, My colleagues and I use his version of sparse for a few > weeks without noticing any downsides. Thanks for the heads up. I just pulled Al's sparse repo. Sorry for the delay. Chris
On Fri, Feb 20, 2026 at 12:06:15AM -0800, Chris Li wrote: > On Thu, Feb 19, 2026 at 11:20 AM Andy Shevchenko > <andriy.shevchenko@intel.com> wrote: > > > > On Thu, Feb 19, 2026 at 09:06:23AM -0800, Chris Li wrote: > > > On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > > > > > > > Can you please take a look? If Al patch is the correct approach, any > > > > chance you can send it and fix this? > > > > > > I am asking in another thread should I pull Al's git repo instead. > > > There are a few good commits there. > > > > Please, pull Al's work, My colleagues and I use his version of sparse for a few > > weeks without noticing any downsides. > > Thanks for the heads up. I just pulled Al's sparse repo. Can you also issue a new tag (say 0.6.5) so the distros can really be pushed to update the quite outdated sparse in their repos? > Sorry for the delay. Thanks! -- With Best Regards, Andy Shevchenko
On Fri, Feb 20, 2026 at 12:31 AM Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > > On Fri, Feb 20, 2026 at 12:06:15AM -0800, Chris Li wrote: > > On Thu, Feb 19, 2026 at 11:20 AM Andy Shevchenko > > <andriy.shevchenko@intel.com> wrote: > > > > > > On Thu, Feb 19, 2026 at 09:06:23AM -0800, Chris Li wrote: > > > > On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > > > > > > > > > Can you please take a look? If Al patch is the correct approach, any > > > > > chance you can send it and fix this? > > > > > > > > I am asking in another thread should I pull Al's git repo instead. > > > > There are a few good commits there. > > > > > > Please, pull Al's work, My colleagues and I use his version of sparse for a few > > > weeks without noticing any downsides. > > > > Thanks for the heads up. I just pulled Al's sparse repo. > > Can you also issue a new tag (say 0.6.5) so the distros can really be pushed to > update the quite outdated sparse in their repos? Sure. I can give it a spin this weekend and keep you posted. There is one risk on my signing key, it might be expired and I need to sort that out. Meanwhile, please give the current sparse repo some good tests. Chris
On Fri, Feb 20, 2026 at 11:34:29AM -0800, Chris Li wrote: > On Fri, Feb 20, 2026 at 12:31 AM Andy Shevchenko > <andriy.shevchenko@intel.com> wrote: > > On Fri, Feb 20, 2026 at 12:06:15AM -0800, Chris Li wrote: > > > On Thu, Feb 19, 2026 at 11:20 AM Andy Shevchenko > > > <andriy.shevchenko@intel.com> wrote: > > > > On Thu, Feb 19, 2026 at 09:06:23AM -0800, Chris Li wrote: > > > > > On Thu, Feb 19, 2026 at 9:00 AM Daniel Gomez <da.gomez@kernel.org> wrote: > > > > > > > > > > > > Can you please take a look? If Al patch is the correct approach, any > > > > > > chance you can send it and fix this? > > > > > > > > > > I am asking in another thread should I pull Al's git repo instead. > > > > > There are a few good commits there. > > > > > > > > Please, pull Al's work, My colleagues and I use his version of sparse for a few > > > > weeks without noticing any downsides. > > > > > > Thanks for the heads up. I just pulled Al's sparse repo. > > > > Can you also issue a new tag (say 0.6.5) so the distros can really be pushed to > > update the quite outdated sparse in their repos? > > Sure. I can give it a spin this weekend and keep you posted. There is > one risk on my signing key, it might be expired and I need to sort > that out. > > Meanwhile, please give the current sparse repo some good tests. It seems that your tip is the same as Al's, and if it's the case we are testing (actually using) this for a few weeks without problems. Thanks! -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.