mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: John Johansen <john.johansen@canonical.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	James Morris <james.l.morris@oracle.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] apparmor: add braces around optional statement
Date: Tue, 20 Jun 2017 22:33:04 +0200	[thread overview]
Message-ID: <20170620203331.609995-1-arnd@arndb.de> (raw)

We get a warning when AA_BUG() compiles to an nothing:

security/apparmor/label.c: In function '__label_update':
security/apparmor/label.c:2055:3: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]

There are two things we can do about this:

- add the missing braces in the call site, which also
  brings the code in line with the regular Linux coding style

- redefine the macro so it is not empty but instead uses
  no_printk() in AA_BUG_FMT() to perform format checking.

Both seem like good ideas, so this does both at once.

Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 security/apparmor/label.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index e052eaba1cf6..f8e08d94a8a6 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -2051,8 +2051,9 @@ static struct aa_label *__label_update(struct aa_label *label)
 			write_lock_irqsave(&ls->lock, flags);
 			goto remove;
 		}
-	} else
+	} else {
 		AA_BUG(labels_ns(label) != labels_ns(new));
+	}
 
 	tmp = __label_insert(labels_set(label), new, true);
 remove:
-- 
2.9.0

                 reply	other threads:[~2017-06-20 20:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170620203331.609995-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=james.l.morris@oracle.com \
    --cc=john.johansen@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /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®