Netdev List
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef
Date: Fri, 23 Sep 2016 13:42:59 -0500	[thread overview]
Message-ID: <87y42i8nkc.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <20160923160650.3631870-1-arnd@arndb.de> (Arnd Bergmann's message of "Fri, 23 Sep 2016 18:06:12 +0200")

Arnd Bergmann <arnd@arndb.de> writes:

> 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 <arnd@arndb.de>

Applied to my namespace tree thanks.

This was a hold over from calling those functions in a different location.

Eric

> ---
>  net/core/net_namespace.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> 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;

      reply	other threads:[~2016-09-23 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 16:06 [PATCH] netns: move {inc,dec}_net_namespaces into #ifdef Arnd Bergmann
2016-09-23 18:42 ` Eric W. Biederman [this message]

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=87y42i8nkc.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.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