From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: checkpatch.pl bug? (was Re: [PATCH] random: Make CPU trust a boot parameter)
Date: Mon, 27 Aug 2018 22:12:18 -0700 [thread overview]
Message-ID: <c07f1fd50d25077f62efbe586bfc40428959d175.camel@perches.com> (raw)
In-Reply-To: <CAGXu5jL9b3Ks95fpq5tdqS1avQysasaCBDzaA31-FVmJCqz=Og@mail.gmail.com>
On Mon, 2018-08-27 at 14:55 -0700, Kees Cook wrote:
> On Mon, Aug 27, 2018 at 2:51 PM, Kees Cook <keescook@chromium.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.
next prev parent reply other threads:[~2018-08-28 5:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 21:55 Kees Cook
2018-08-28 5:12 ` Joe Perches [this message]
2018-08-28 5:33 ` [PATCH] checkpatch: Add __ro_after_init to known $Attribute Joe Perches
2018-08-28 5:44 ` Kees Cook
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=c07f1fd50d25077f62efbe586bfc40428959d175.camel@perches.com \
--to=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®