From: Stephen Hemminger <stephen@networkplumber.org>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: Moshe Shemesh <moshe@mellanox.com>,
netdev@vger.kernel.org,
Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [RFC] rtnetlink: handle multiple vlan tags in set_vf_vlan
Date: Thu, 21 Feb 2019 10:52:53 -0800 [thread overview]
Message-ID: <20190221105253.422433db@shemminger-XPS-13-9360> (raw)
In-Reply-To: <20190221193457.7861791e@redhat.com>
On Thu, 21 Feb 2019 19:34:57 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:
> On Thu, 21 Feb 2019 09:54:36 -0800
> Stephen Hemminger <stephen@networkplumber.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.
>
Your right with empty list it would fall through and look at other attributes
which could overwrite err.
next prev parent reply other threads:[~2019-02-21 18:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 17:54 [RFC] rtnetlink: handle multiple vlan tags in set_vf_vlan Stephen Hemminger
2019-02-21 18:34 ` Stefano Brivio
2019-02-21 18:52 ` Stephen Hemminger [this message]
2019-02-22 4:58 ` Moshe Shemesh
2019-02-22 18:09 ` Stephen Hemminger
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=20190221105253.422433db@shemminger-XPS-13-9360 \
--to=stephen@networkplumber.org \
--cc=moshe@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=sbrivio@redhat.com \
--cc=sthemmin@microsoft.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).