[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c07f1fd50d25077f62efbe586bfc40428959d175.camel@perches.com>
Date: Mon, 27 Aug 2018 22:12:18 -0700
From: Joe Perches <joe@...ches.com>
To: Kees Cook <keescook@...omium.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: checkpatch.pl bug? (was Re: [PATCH] random: Make CPU trust a
boot parameter)
On Mon, 2018-08-27 at 14:55 -0700, Kees Cook wrote:
> On Mon, Aug 27, 2018 at 2:51 PM, Kees Cook <keescook@...omium.org> wrote:
> > Instead of forcing a distro or other system builder to choose
> > at build time whether the CPU is trusted for CRNG seeding via
> > CONFIG_RANDOM_TRUST_CPU, provide a boot-time parameter for end users to
> > control the choice. The CONFIG will set the default state instead.
[]
> > diff --git a/drivers/char/random.c b/drivers/char/random.c
[]
> > @@ -779,6 +779,13 @@ static struct crng_state **crng_node_pool __read_mostly;
> >
> > static void invalidate_batched_entropy(void);
> >
> > +static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU);
> > +static int __init parse_trust_cpu(char *arg)
> > +{
> > + return kstrtobool(arg, &trust_cpu);
> > +}
> > +early_param("random.trust_cpu", parse_trust_cpu);
> > +
> > static void crng_initialize(struct crng_state *crng)
> > {
> > int i;
> > @@ -799,12 +806,10 @@ static void crng_initialize(struct crng_state *crng)
> > }
> > crng->state[i] ^= rv;
> > }
> > -#ifdef CONFIG_RANDOM_TRUST_CPU
> > - if (arch_init) {
> > + if (trust_cpu && arch_init) {
>
> checkpatch.pl complains:
>
> ERROR: space prohibited after that '&&' (ctx:WxW)
> #79: FILE: drivers/char/random.c:809:
> + if (trust_cpu && arch_init) {
> ^
>
> I can't figure out what is going on here. Using "||" doesn't trigger
> the issue; it seems related to the earlier "&trust_cpu" use in the
> patch, but I can't figure out what checkpatch was trying to do with
> this...
It's the __ro_after_init after the declaration of
static bool trust_cpu that confuses checkpatch.
I'll see what can be done for that.
Powered by blists - more mailing lists