From patchwork Tue Jun 20 20:33:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9800201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62FB5600F5 for ; Tue, 20 Jun 2017 20:33:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5233620007 for ; Tue, 20 Jun 2017 20:33:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4692C25F3E; Tue, 20 Jun 2017 20:33:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD0CB20007 for ; Tue, 20 Jun 2017 20:33:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090AbdFTUdk (ORCPT ); Tue, 20 Jun 2017 16:33:40 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:50523 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbdFTUdk (ORCPT ); Tue, 20 Jun 2017 16:33:40 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0LuYWS-1dnmOa2mbw-00zpx0; Tue, 20 Jun 2017 22:33:32 +0200 From: Arnd Bergmann To: John Johansen Cc: Arnd Bergmann , James Morris , "Serge E. Hallyn" , 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 Message-Id: <20170620203331.609995-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:RTEa+huNgcBINgEKF7NnTBym/BX45QUZ4EOiOUkIr8L8BdIxH43 CXGkWaXEeHBokOOXya7SibvXRACAra+f3Kt055BiSboKmctnb9otVOgtn0gWQIKbc095Ev4 Ys0vE3ljmUzzczyOjlUD2yj0eOgdFDaKjqrscerDaeGoH7D3W+fy9izJSDUVZRioQfib0oY mETltZjhZWLKKMFDExJ7w== X-UI-Out-Filterresults: notjunk:1; V01:K0:PTVzjxIjBlo=:mZf2LkChOKDI3F/JXT0WNa zu/3JhJMgcesockqp6jpwOK6nWnx11b1uk1EH9l8r4gvpfx45kSmBmpr69sFEhqEbgQri32we vbRKhLbjo3AyCoH/XZejyFODyi63rQIUgbAEnUkzI+yCKZEssfbYrx+vOsyEJbq30WsS0fdTV amV3JvbeqOtgrx/+fCCN/30s7b8y3sJF2hoUkU+O30WrkNYkKWzeO9uATff3rAWcFdBc6/HWY yu4AR8I0H84TjkwQHsT0KfNf1njLJW6U9lc4b+kAq7eMgV6ajwSN/47ipVZgddmhAHrRzlXBS CGSxNABw9zoIj3tnHt267e41E8Yj3Sgmd0qhIpdxsxry48Q3iWJTDLhOXVxqUDoRBQ8iElbUc JgrXim4ghbFVbGE44n+zsNdbTx+FdJK2icLbJKFTdKjTD7WOEMsRAyHqtRpBP8dh6zj/mNVo4 J0vw8PR5Moo61JTOb8AqYMrZrvoFttyE7YUOMPz+4IS4fa8D+bfY6WkvD7B7YGgDzV9wkJ/Gk 2/JQW6uhdHQiE1jzd6MXONd71NDS+34JoviqRs8WWilr6TogxeHLSnMzAuRu+wXmLnbulSqoe ZxsGF+XRWYdXeB8omdmemujmGLTenNSiKWsOVmieKzwhv8t51oWcDIcYGiwGXOK1zZf5cUAi7 mxmISZ9gxZIsvsmmBE5KagVcPKU7MYRBPtS2lW9eNQJ+t6v1TwhiNKOGSKL5hZNKndl8= Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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: