[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <335cb3ec-429a-9082-ce0e-d44af7722e4e@huawei.com>
Date: Sat, 1 Sep 2018 09:34:25 +0800
From: YueHaibing <yuehaibing@...wei.com>
To: "Samudrala, Sridhar" <sridhar.samudrala@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Stephen Hemminger <stephen@...workplumber.org>,
"Dan Carpenter" <dan.carpenter@...cle.com>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
Liran Alon <liran.alon@...cle.com>,
Joao Martins <joao.m.martins@...cle.com>
CC: <netdev@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH net-next] failover: remove set but not used variable
'primary_dev'
On 2018/9/1 0:39, Samudrala, Sridhar wrote:
> 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?
>
sure, thank you. will send v2
>
>>
>> Signed-off-by: YueHaibing <yuehaibing@...wei.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);
>>
>
>
> .
>
Powered by blists - more mailing lists