All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@canonical.com>
Cc: Kees Cook <keescook@chromium.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] checkpatch: Add __ro_after_init to known $Attribute
Date: Mon, 27 Aug 2018 22:33:16 -0700	[thread overview]
Message-ID: <0fa8a2cb83ade4c525e18261ecf6cfede3015983.camel@perches.com> (raw)
In-Reply-To: <c07f1fd50d25077f62efbe586bfc40428959d175.camel@perches.com>

__ro_after_init is a specific __attribute__ that checkpatch
does currently not understand.

Add it to the known $Attribute types so that code that uses
variables declared with __ro_after_init are not thought to
be a modifier type.

This appears as a defect in checkpatch output of code like:

static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU);
[...]
       if (trust_cpu && arch_init) {

where checkpatch reports:

ERROR: space prohibited after that '&&' (ctx:WxW)
	if (trust_cpu && arch_init) {

Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5219280bf7ff..23cde9d90278 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -380,6 +380,7 @@ our $Attribute	= qr{
 			__noclone|
 			__deprecated|
 			__read_mostly|
+			__ro_after_init|
 			__kprobes|
 			$InitAttribute|
 			____cacheline_aligned|

  reply	other threads:[~2018-08-28  5:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 21:55 checkpatch.pl bug? (was Re: [PATCH] random: Make CPU trust a boot parameter) Kees Cook
2018-08-28  5:12 ` Joe Perches
2018-08-28  5:33   ` Joe Perches [this message]
2018-08-28  5:44     ` [PATCH] checkpatch: Add __ro_after_init to known $Attribute 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=0fa8a2cb83ade4c525e18261ecf6cfede3015983.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.