public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
	Hadar Hen Zion <hadarh@mellanox.com>,
	"David S . Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [net] net/mlx5e: fix another -Wmaybe-uninitialized warning
Date: Thu, 12 Jan 2017 11:10:32 +0100	[thread overview]
Message-ID: <3829004.7hNWuNXvZt@wuerfel> (raw)
In-Reply-To: <5cc9060f-6802-8634-f144-4637e9576ef1@mellanox.com>

On Thursday, January 12, 2017 10:30:24 AM CET Or Gerlitz wrote:
> On 1/11/2017 11:14 PM, Arnd Bergmann wrote:
> > @@ -666,14 +666,15 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
> >       struct rtable *rt;
> >       struct neighbour *n = NULL;
> >       int ttl;
> > +     int ret;
> > +
> > +     if (!IS_ENABLED(CONFIG_INET))
> > +             return -EOPNOTSUPP;
> >   
> > -#if IS_ENABLED(CONFIG_INET)
> >       rt = ip_route_output_key(dev_net(mirred_dev), fl4);
> > -     if (IS_ERR(rt))
> > -             return PTR_ERR(rt);
> > -#else
> > -     return -EOPNOTSUPP;
> > -#endif
> > +     ret = PTR_ERR_OR_ZERO(rt);
> > +     if (ret)
> > +             return ret;
> 
> but this means that if we got NULL from ip_route_output_key, we will 
> return success (0) here which is wrong.

I don't think so: if 'rt' is NULL or a valid pointer, then 'ret' is zero
and we will not return here.

	Arnd

  reply	other threads:[~2017-01-12 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 21:14 [PATCH] [net] net/mlx5e: fix another -Wmaybe-uninitialized warning Arnd Bergmann
2017-01-12  8:30 ` Or Gerlitz
2017-01-12 10:10   ` Arnd Bergmann [this message]
2017-01-12 15:21 ` Or Gerlitz
2017-01-12 16:04   ` Arnd Bergmann
2017-01-12 20:55     ` Or Gerlitz

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=3829004.7hNWuNXvZt@wuerfel \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=hadarh@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=saeedm@mellanox.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