Re: [PATCH] kconfig: add kconfig-sym-check static checker

From: Andrew Jones

Date: Thu May 14 2026 - 09:51:42 EST


On Thu, May 14, 2026 at 10:32:12PM +0900, Nathan Chancellor wrote:
> On Wed, 13 May 2026 16:03:29 -0500, Andrew Jones <andrew.jones@xxxxxxxxx> wrote:
>
> Hi Andrew,
>
> > [...]
> >
> > This new static checker is the script used for [1] with a few
> > improvements to avoid some false positives.
> >
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=216748 [1]
> > Signed-off-by: Andrew Jones <andrew.jones@xxxxxxxxx>
>
> I think something like this is reasonable, as least until kconfirm
> is potentially ready for integration into the tree.
>
> https://lore.kernel.org/20260509203808.1142311-1-julianbraha@xxxxxxxxx/
>
> That said, I don't know perl, so some superficial comments to follow.
>
> >
> >
> > diff --git a/Makefile b/Makefile
> > index e27c91ea56fc..75487383805b 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2240,6 +2242,9 @@ versioncheck:
> > coccicheck:
> > $(Q)$(BASH) $(srctree)/scripts/$@
> >
> > +kconfig-sym-check:
> > + $(Q)cd $(srctree) && $(PERL) scripts/kconfig/kconfig-sym-check.pl $(KCONFIG_SYM_CHECK_EXCLUDES)
>
> I would prefer to avoid the 'cd $(srctree)' here.
>
> >
> > diff --git a/scripts/kconfig/kconfig-sym-check.pl b/scripts/kconfig/kconfig-sym-check.pl
> > new file mode 100755
> > index 000000000000..a6907e585962
> > --- /dev/null
> > +++ b/scripts/kconfig/kconfig-sym-check.pl
> > @@ -0,0 +1,93 @@
> > +#!/usr/bin/env perl
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +use warnings;
> > +use strict;
> > +
> > +my $kconfig_sym_check_excludes = undef;
> > +$kconfig_sym_check_excludes = $ARGV[0] if (defined $ARGV[0]);
> > +
> > +my @files = `git ls-files '*Kconfig*'`;
>
> What happens if you run this command on a release tarball? We should
> probably use something like
>
> find $(srctree) -name '*Kconfig*'
>
> here, which would avoid needing the 'cd $(srctree)' above (although
> kconfig-sym-check.pl would need to be prefixed with $(srctree)/ to
> ensure the path is valid).
>
> Sashiko has some additional comments that may be relevant, if you have
> not already seen them.
>
> https://sashiko.dev/#/patchset/19870

Thanks, Nathan. I'll make some improvements based on your and Sashiko's
comments and send a v2.

drew