From nobody Wed Feb 11 10:17:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489178319669310.00194310041536; Fri, 10 Mar 2017 12:38:39 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2AKZIXI046110; Fri, 10 Mar 2017 15:35:20 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2AKZIrt018931 for ; Fri, 10 Mar 2017 15:35:18 -0500 Received: from vhost2.laine.org (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2AKZHiY012172 for ; Fri, 10 Mar 2017 15:35:18 -0500 From: Laine Stump To: libvir-list@redhat.com Date: Fri, 10 Mar 2017 15:34:54 -0500 Message-Id: <20170310203512.15478-2-laine@laine.org> In-Reply-To: <20170310203512.15478-1-laine@laine.org> References: <20170310203512.15478-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/19] util: permit querying a VF MAC address or VLAN tag by itself X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" virNetDevParseVfConfig() assumed that both the MAC address and VLAN tag pointers were valid, so even if you only wanted one or the other, you would need a variable to hold the returned value for both. This patch checks each for a NULL pointer before filling it in. --- src/util/virnetdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index d123248..75f969d 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1534,7 +1534,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf= , virMacAddrPtr mac, goto cleanup; } =20 - if (tb[IFLA_VF_MAC]) { + if (mac && tb[IFLA_VF_MAC]) { vf_mac =3D RTA_DATA(tb_vf[IFLA_VF_MAC]); if (vf_mac && vf_mac->vf =3D=3D vf) { virMacAddrSetRaw(mac, vf_mac->mac); @@ -1542,7 +1542,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf= , virMacAddrPtr mac, } } =20 - if (tb[IFLA_VF_VLAN]) { + if (vlanid && tb[IFLA_VF_VLAN]) { vf_vlan =3D RTA_DATA(tb_vf[IFLA_VF_VLAN]); if (vf_vlan && vf_vlan->vf =3D=3D vf) { *vlanid =3D vf_vlan->vlan; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list