[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190221193457.7861791e@redhat.com>
Date: Thu, 21 Feb 2019 19:34:57 +0100
From: Stefano Brivio <sbrivio@...hat.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Moshe Shemesh <moshe@...lanox.com>, netdev@...r.kernel.org,
Stephen Hemminger <sthemmin@...rosoft.com>
Subject: Re: [RFC] rtnetlink: handle multiple vlan tags in set_vf_vlan
On Thu, 21 Feb 2019 09:54:36 -0800
Stephen Hemminger <stephen@...workplumber.org> wrote:
> @@ -2224,13 +2223,15 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
>
> len++;
> }
> - if (len == 0)
> - return -EINVAL;
>
> - err = ops->ndo_set_vf_vlan(dev, ivvl[0]->vf, ivvl[0]->vlan,
> - ivvl[0]->qos, ivvl[0]->vlan_proto);
> - if (err < 0)
> - return err;
> + err = -EINVAL; /* empty list error */
> + for (i = 0; i < len; i++) {
> + err = ops->ndo_set_vf_vlan(dev, ivvl[i]->vf,
> + ivvl[i]->vlan, ivvl[i]->qos,
> + ivvl[i]->vlan_proto);
> + if (err < 0)
> + return err;
> + }
I think the:
if (err < 0)
return err;
should be outside the loop (with a "break;" inside), otherwise you won't
return anymore if len == 0.
--
Stefano
Powered by blists - more mailing lists