From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68A96C43381 for ; Thu, 21 Feb 2019 18:35:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 336AC2081B for ; Thu, 21 Feb 2019 18:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbfBUSfF (ORCPT ); Thu, 21 Feb 2019 13:35:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfBUSfF (ORCPT ); Thu, 21 Feb 2019 13:35:05 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 874CB3006031; Thu, 21 Feb 2019 18:35:05 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E107A5D70E; Thu, 21 Feb 2019 18:35:03 +0000 (UTC) Date: Thu, 21 Feb 2019 19:34:57 +0100 From: Stefano Brivio To: Stephen Hemminger Cc: Moshe Shemesh , netdev@vger.kernel.org, Stephen Hemminger Subject: Re: [RFC] rtnetlink: handle multiple vlan tags in set_vf_vlan Message-ID: <20190221193457.7861791e@redhat.com> In-Reply-To: <20190221175436.10767-1-sthemmin@microsoft.com> References: <20190221175436.10767-1-sthemmin@microsoft.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 21 Feb 2019 18:35:05 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 21 Feb 2019 09:54:36 -0800 Stephen Hemminger 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