lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170620203331.609995-1-arnd@arndb.de>
Date:   Tue, 20 Jun 2017 22:33:04 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     John Johansen <john.johansen@...onical.com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        James Morris <james.l.morris@...cle.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] apparmor: add braces around optional statement

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@...db.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ