On Thu, 21 Feb 2019 09:54:36 -0800
Stephen Hemminger <[email protected]> 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