[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B6174D2A-C9E8-438D-A042-C39CAAA35728@redhat.com>
Date: Fri, 31 May 2019 10:44:38 +0200
From: Matteo Croce <mcroce@...hat.com>
To: Joe Perches <joe@...ches.com>, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...onical.com>
CC: Kees Cook <keescook@...omium.org>,
Aaron Tomlin <atomlin@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] checkpatch.pl: Warn on duplicate sysctl local variable
On May 31, 2019 5:06:58 AM GMT+02:00, Joe Perches <joe@...ches.com> wrote:
> On Fri, 2019-05-31 at 03:12 +0200, Matteo Croce wrote:
> > Commit 6a33853c5773 ("proc/sysctl: add shared variables for range
> check")
> > adds some shared const variables to be used instead of a local copy
> in
> > each source file.
> > Warn when a chunk duplicates one of these values in a ctl_table
> struct:
> >
> > $ scripts/checkpatch.pl 0001-test-commit.patch
> > WARNING: duplicated sysctl range checking value 'zero', consider
> using the shared one in include/linux/sysctl.h
> > #27: FILE: arch/arm/kernel/isa.c:48:
> > + .extra1 = &zero,
> >
> > WARNING: duplicated sysctl range checking value 'int_max',
> consider using the shared one in include/linux/sysctl.h
> > #28: FILE: arch/arm/kernel/isa.c:49:
> > + .extra2 = &int_max,
> >
> > total: 0 errors, 2 warnings, 14 lines checked
> >
> > Signed-off-by: Matteo Croce <mcroce@...hat.com>
> > ---
> > scripts/checkpatch.pl | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 342c7c781ba5..629c31435487 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -6639,6 +6639,12 @@ sub process {
> > "unknown module license " . $extracted_string . "\n" .
> $herecurr);
> > }
> > }
> > +
> > +# check for sysctl duplicate constants
> > + if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max|max_int)\b/) {
>
> why max_int, there isn't a single use of it in the kernel ?
Because you can never know how a local variabile will be called.
I wanted to add intmax and maxint too, bit it seemed too much.
Bye,
--
Matteo Croce
per aspera ad upstream
Powered by blists - more mailing lists