From patchwork Fri Sep 23 16:06:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101749 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp649251qgf; Fri, 23 Sep 2016 09:07:34 -0700 (PDT) X-Received: by 10.98.213.68 with SMTP id d65mr13607617pfg.112.1474646854535; Fri, 23 Sep 2016 09:07:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g68si8482888pfb.36.2016.09.23.09.07.34; Fri, 23 Sep 2016 09:07:34 -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 S1035445AbcIWQHZ (ORCPT + 27 others); Fri, 23 Sep 2016 12:07:25 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:58299 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030326AbcIWQHV (ORCPT ); Fri, 23 Sep 2016 12:07:21 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MAihL-1bhBLS0bN5-00BpMH; Fri, 23 Sep 2016 18:06:53 +0200 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , "Eric W. Biederman" , WANG Cong , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef Date: Fri, 23 Sep 2016 18:06:12 +0200 Message-Id: <20160923160650.3631870-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:5rUwxKCp7FoDieTNxsFr86UbZ3wo8JDYzq/15GANgjwaOr0okVl m15ZbHZld13eJZGh3GUTuF0pbKqLCdpFGxmfmp4NcqaOoFegPByrcSRIu07YYmSmeEmhOSd J+YSIIEKVID8JyfeFUmBCd/SdkXXZOPbgknh4DL9Ot8lLAvw2CllEQZbsZg+ZR47LBqX5z2 RfjR6XvKbDShcHhpfmurA== X-UI-Out-Filterresults: notjunk:1; V01:K0:huXWiBrk4BU=:hWIF57M8T7ZDR3EwsBqkCi KxXGAiQUcEWdAmGMPbHQs3PFnaVLOpDwbnQN62nBWFBUqoMrdlbiGzB2Rjl2+12CHHYqgihFf DSB/awweLIrEhA5fZIll1I9+WHQpm+oW/kWgX66+iar9vP9Zf+JHIG0ihdygwJpgL8sH87kDc 0Eoe9wnxIxG1bihqys+z128yl7vqpVyhgl+HwIYY/1t494qUauzofWvshpO5vjTc55/7Ed9vP H1cOuK4iUa/mldPTSLK1dOx2sxwY1IApi7LgqXsCRrmlw7OixoodCUq6TypAtcSkSuyGsHude z27oGsV1XpQRQ0yZPuX1ibld8KrdJnK+5sPZ72S2dT3xf8b96yoxpibwcJsnO09LC/nhGn12W gw3JXJMbrL1E0KDQPgzHsQQXVIwzsHm3ZR2Wz95K4Oiw2zdXFlyxQh5qK/goY2+79lTLQNTI6 sLk4pDXlf0FljoG/ZpsI/cfT2doWsuTugxha3841sFU4wGST51chM9VKIFCMH4uNr5qk2ljkB soP5YASuvkX8mh5Ub+OW1caGAhXR5RVPMP97sVMx4LVY7E/3ZVNbZcZdJFncQBLUpZt7X5OLX zq5YIOhRwlF3rrxXGw54AwqMEKspjw7X9u4EEsrvIWketuHrL0c7OwaYANt97Rq4FLrxs0vb7 slnQSl0t9wL5huffl/Nbvz4Z8/0t6q1HQ+YJfOSYzbA/XKpx6BULsf0hzLhNNWoyei6g= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the newly enforced limit on the number of namespaces, we get a build warning if CONFIG_NETNS is disabled: net/core/net_namespace.c:273:13: error: 'dec_net_namespaces' defined but not used [-Werror=unused-function] net/core/net_namespace.c:268:24: error: 'inc_net_namespaces' defined but not used [-Werror=unused-function] This moves the two added functions inside the #ifdef that guards their callers. Fixes: 703286608a22 ("netns: Add a limit on the number of net namespaces") Signed-off-by: Arnd Bergmann --- net/core/net_namespace.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.9.0 diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index d0eb13d3226b..989434f36f96 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -265,16 +265,6 @@ struct net *get_net_ns_by_id(struct net *net, int id) return peer; } -static struct ucounts *inc_net_namespaces(struct user_namespace *ns) -{ - return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES); -} - -static void dec_net_namespaces(struct ucounts *ucounts) -{ - dec_ucount(ucounts, UCOUNT_NET_NAMESPACES); -} - /* * setup_net runs the initializers for the network namespace object. */ @@ -319,6 +309,16 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns) #ifdef CONFIG_NET_NS +static struct ucounts *inc_net_namespaces(struct user_namespace *ns) +{ + return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES); +} + +static void dec_net_namespaces(struct ucounts *ucounts) +{ + dec_ucount(ucounts, UCOUNT_NET_NAMESPACES); +} + static struct kmem_cache *net_cachep; static struct workqueue_struct *netns_wq;