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: 106021 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1588624qgd; Tue, 20 Jun 2017 13:34:00 -0700 (PDT) X-Received: by 10.84.225.18 with SMTP id t18mr31503898plj.273.1497990840221; Tue, 20 Jun 2017 13:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497990840; cv=none; d=google.com; s=arc-20160816; b=V8vrA6vsCbv6J9H8BU3kS28+Alf/paGE9oevHLljK+wg7iMSyvv4jvfDsSGs8ZLHXi 1N4e4KtWw8FsLb/vN83F+Br/1XG9rNr1QAsKm/GA4lxJssk+Fw3RomxsdWPktMtX73U8 UQFcFR9lvWKftaA2ek5SOkUYlpuYVaAaBgGK9aqk48rx4NBY8EN36X+jCBd6hp7VCvfh U03BZyVxclOPOP8Vc8smBXYloR51oE4eIzpcdjIK0Zd7Y06CEfl/v602qqwzYRccRDjo Mg0pspMptJfIL7ULK7m61Q8P+ecbolzOiA5/dH/ECgTEQwkHKN+MgCcptyzUfvknKelL 1xqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Qv6dKc2rH1bSZ8WkoyzrFMQeZGNlLCVebv+SowK2ZEM=; b=m5emlur6oBONj7k9T2n0I5WndDXJEwUvuVqM9LiflpGpK/2RJZGWcaL/L69HweVr6k UgRzAAsQnneS36LLd2RBpx53fhffpIjMX0E9gdBfBZsset/RCRwbuAjRDK1oj+xPqpJf Jqnx+oqrD1JINsTiPS01t7sHr/S7zmcOD0qXRAs4htXlGVHY5OhkTXWoUSbOGV0ldvH8 Fo0P0oboNhz8bzzCtbkGecRw3Fb3NIE/95uOKUKrXtEz2o8vSJkF3Nl7bV5AsT2KyCc1 rOafuvJh1FLXxwENvBCqRS39aha6UD7X6EcESOxGwRJkxLq/dQfhMugni5wuRurMZ2hy /niA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f186si11708307pgc.56.2017.06.20.13.33.59; Tue, 20 Jun 2017 13:34:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbdFTUdl (ORCPT + 25 others); Tue, 20 Jun 2017 16:33:41 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 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: