netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
To: YueHaibing <yuehaibing@huawei.com>,
	"David S. Miller" <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	Liran Alon <liran.alon@oracle.com>,
	Joao Martins <joao.m.martins@oracle.com>
Cc: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] failover: remove set but not used variable 'primary_dev'
Date: Fri, 31 Aug 2018 09:39:38 -0700	[thread overview]
Message-ID: <23e9e24a-dfec-e112-0745-d29e4742c057@intel.com> (raw)
In-Reply-To: <1535687218-23169-1-git-send-email-yuehaibing@huawei.com>

On 8/30/2018 8:46 PM, YueHaibing wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/net/net_failover.c: In function 'net_failover_slave_unregister':
> drivers/net/net_failover.c:598:35: warning:
>   variable 'primary_dev' set but not used [-Wunused-but-set-variable]

Actually this gcc option found a bug.
We need to add this check after accessing primary_dev and standby_dev.

         if (slave_dev != primary_dev && slave_dev != standby_dev)
                 return -ENODEV;

Can you resubmit with the right fix?


>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>   drivers/net/net_failover.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
> index 7ae1856..e103c94e 100644
> --- a/drivers/net/net_failover.c
> +++ b/drivers/net/net_failover.c
> @@ -595,12 +595,11 @@ static int net_failover_slave_pre_unregister(struct net_device *slave_dev,
>   static int net_failover_slave_unregister(struct net_device *slave_dev,
>   					 struct net_device *failover_dev)
>   {
> -	struct net_device *standby_dev, *primary_dev;
> +	struct net_device *standby_dev;
>   	struct net_failover_info *nfo_info;
>   	bool slave_is_standby;
>   
>   	nfo_info = netdev_priv(failover_dev);
> -	primary_dev = rtnl_dereference(nfo_info->primary_dev);
>   	standby_dev = rtnl_dereference(nfo_info->standby_dev);
>   
>   	vlan_vids_del_by_dev(slave_dev, failover_dev);
>

  reply	other threads:[~2018-08-31 20:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-31  3:46 [PATCH net-next] failover: remove set but not used variable 'primary_dev' YueHaibing
2018-08-31 16:39 ` Samudrala, Sridhar [this message]
2018-09-01  1:34   ` YueHaibing
2018-09-01  3:06 ` [PATCH net-next] failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister YueHaibing
2018-09-02  8:34   ` Liran Alon
2018-09-04  2:56   ` [PATCH v2 " YueHaibing
2018-09-04 16:36     ` Samudrala, Sridhar
2018-09-06  5:16     ` David Miller

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=23e9e24a-dfec-e112-0745-d29e4742c057@intel.com \
    --to=sridhar.samudrala@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=yuehaibing@huawei.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;
as well as URLs for NNTP newsgroup(s).