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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a3Wegxxpjn00Ru6PX4JpwrQUQFbw46EnABR9Q4ThZTe-A@mail.gmail.com>
Date:   Wed, 6 Mar 2019 09:32:59 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     Jamal Hadi Salim <jhs@...atatu.com>, Jiri Pirko <jiri@...nulli.us>,
        "David S. Miller" <davem@...emloft.net>,
        Vlad Buslov <vladbu@...lanox.com>,
        Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
        Davide Caratti <dcaratti@...hat.com>,
        Simon Horman <simon.horman@...ronome.com>,
        Adi Nissim <adin@...lanox.com>, wenxu <wenxu@...oud.cn>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/sched: avoid unused-label warning

On Wed, Mar 6, 2019 at 1:28 AM Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Mon, Mar 4, 2019 at 12:40 PM Arnd Bergmann <arnd@...db.de> wrote:
> > diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
> > index 2a5f215ae876..3beb4717d3b7 100644
> > --- a/net/sched/act_tunnel_key.c
> > +++ b/net/sched/act_tunnel_key.c
> > @@ -392,8 +392,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
> >  #ifdef CONFIG_DST_CACHE
> >         if (metadata)
> >                 dst_cache_destroy(&metadata->u.tun_info.dst_cache);
> > -#endif
> >  release_tun_meta:
> > +#endif
>
> These #ifdef's are ugly, either we should select DST_CACHE
> or provide a nop for these dst_cache_*() APIs when it is not
> enabled.

I agree that would be nicer, or alternatively convert the preprocessor
conditionals to C conditionals like

diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 3beb4717d3b7..586343a5accc 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -327,11 +327,11 @@ static int tunnel_key_init(struct net *net,
struct nlattr *nla,
                        goto err_out;
                }

-#ifdef CONFIG_DST_CACHE
-               ret = dst_cache_init(&metadata->u.tun_info.dst_cache,
GFP_KERNEL);
-               if (ret)
-                       goto release_tun_meta;
-#endif
+               if (IS_ENABLED(CONFIG_DST_CACHE)) {
+                       ret =
dst_cache_init(&metadata->u.tun_info.dst_cache, GFP_KERNEL);
+                       if (ret)
+                               goto release_tun_meta;
+               }

                if (opts_len) {
                        ret = tunnel_key_opts_set(tb[TCA_TUNNEL_KEY_ENC_OPTS],
@@ -389,11 +389,9 @@ static int tunnel_key_init(struct net *net,
struct nlattr *nla,
        return ret;

 release_dst_cache:
-#ifdef CONFIG_DST_CACHE
        if (metadata)
                dst_cache_destroy(&metadata->u.tun_info.dst_cache);
 release_tun_meta:
-#endif
        if (metadata)
                dst_release(&metadata->dst);

Usually, you'd want to do that consistently though, and change all the
related checks at the same time, so I would keep that separate from
the trivial bugfix.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ