From nobody Sun May 5 21:48:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154185557073510.085116165071213; Sat, 10 Nov 2018 05:12:50 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B5AF58E3C; Sat, 10 Nov 2018 13:12:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBA0119753; Sat, 10 Nov 2018 13:12:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6951C4CAA0; Sat, 10 Nov 2018 13:12:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAACueIU022798 for ; Sat, 10 Nov 2018 07:56:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 620506015E; Sat, 10 Nov 2018 12:56:40 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57FAC6013F for ; Sat, 10 Nov 2018 12:56:38 +0000 (UTC) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06EF83082125 for ; Sat, 10 Nov 2018 12:56:37 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id k19-v6so3833304lji.11 for ; Sat, 10 Nov 2018 04:56:36 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h16-v6sm2145024lfc.0.2018.11.10.04.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e+mT0DZkcvqrBMyR+P9cV2e4Y0jqelEzRORpP/6dbio=; b=kc4Q15pYNTAO66yjdJvi7ZEuVqUJGuZGOGwi695Yc4lmeshREU2xmeS+xA71lUnaBE QNSIACwuSGN0S2zG5BQduc75GVsJIVG0Tmf8aX54PWK1yrKNUHZfxUM0nPjhI3oLrgGm Ff2qlNadJg4SStGg/Dg8PwJs5aTjDR0J6zoa8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e+mT0DZkcvqrBMyR+P9cV2e4Y0jqelEzRORpP/6dbio=; b=eiaGgmo15oETJbqVHH1Q25vwWW9h+IRhWL1LMxSSVEyrN40v6IyhWGs8cJizI9eRnK THfQvDkasPN4PtqhwDA3GngrovJ6m6SqVAmKUjYPe0jwSrd0VNAl/1yl4ypxKRUNKHMf 8nHTyFqgI7NIm3Wh/sEXQGPUeEukUlFiiBo2wIw8TD7RzN3bGcMAGDOMXKfSfDkh7TgW xAoosDQ4uZ7vKozdF3uKIL9jM824xaqXp8/BOompNaZBsnt0EUUTB6IHfvSnPlYNTTpU y4QzKQlOpUAxVXVuj9LH03rAf+3PQCqaouiyIzwSsiRTsREptInHWCKgg3qq0ssacE0Z UERA== X-Gm-Message-State: AGRZ1gKHaSFyleDXsJqVZFz1tYB3x5jpiYMcDwcmaRch0b9/wMiHGPko jxkgJLDxSNujo6slMc2AlFLce07d8Ns= X-Google-Smtp-Source: AJdET5f+gBdp0plRJevKC+pxgUb5t9gbeJww+f3RSPxwU48mtajuY7Z3XqJ7OQUh8PNCcDzsQScgQA== X-Received: by 2002:a2e:2416:: with SMTP id k22-v6mr8491973ljk.80.1541854595078; Sat, 10 Nov 2018 04:56:35 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com Date: Sat, 10 Nov 2018 13:56:21 +0100 Message-Id: <20181110125624.1168-2-radoslaw.biernacki@linaro.org> In-Reply-To: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 10 Nov 2018 12:56:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 10 Nov 2018 12:56:37 +0000 (UTC) for IP:'209.85.208.194' DOMAIN:'mail-lj1-f194.google.com' HELO:'mail-lj1-f194.google.com' FROM:'radoslaw.biernacki@linaro.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.208.194 mail-lj1-f194.google.com 209.85.208.194 mail-lj1-f194.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 1/4] util: fixing wrong assumption that PF has to have netdev assigned 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-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 10 Nov 2018 13:12:49 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" libvirt wrongly assumes that VF netdev has to have the netdev assigned to PF. There is no such requirement in SRIOV standard. This patch change the virNetDevSwitchdevFeature() function to deal with SRIOV devices which does not have netdev on PF. Also removes one comment about PF netdev assumption. One example of such devices is ThunderX VNIC. By applying this change, VF device is used for virNetlinkCommand() as it is the only netdev assigned to VNIC. Signed-off-by: Radoslaw Biernacki --- src/util/virnetdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 5867977df4..e55c538a29 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1359,9 +1359,6 @@ virNetDevGetPhysicalFunction(const char *ifname, char= **pfname) } =20 if (!*pfname) { - /* this shouldn't be possible. A VF can't exist unless its - * PF device is bound to a network driver - */ virReportError(VIR_ERR_INTERNAL_ERROR, _("The PF device for VF %s has no network device na= me"), ifname); @@ -3182,8 +3179,11 @@ virNetDevSwitchdevFeature(const char *ifname, if ((is_vf =3D virNetDevIsVirtualFunction(ifname)) < 0) return ret; =20 - if (is_vf =3D=3D 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < = 0) - goto cleanup; + if (is_vf =3D=3D 1) { + /* ignore error if PF does noto have netdev assigned + * in that case pfname =3D=3D NULL */ + ignore_value(virNetDevGetPhysicalFunction(ifname, &pfname)); + } =20 pci_device_ptr =3D pfname ? virNetDevGetPCIDevice(pfname) : virNetDevGetPCIDevice(ifname); --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 21:48:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541855582082772.811398582435; Sat, 10 Nov 2018 05:13:02 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 214112D2BF9; Sat, 10 Nov 2018 13:13:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB86160C66; Sat, 10 Nov 2018 13:12:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 80965180053A; Sat, 10 Nov 2018 13:12:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAACugN0022806 for ; Sat, 10 Nov 2018 07:56:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F196101963A; Sat, 10 Nov 2018 12:56:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 750261019626 for ; Sat, 10 Nov 2018 12:56:39 +0000 (UTC) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BA50308AA13 for ; Sat, 10 Nov 2018 12:56:38 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id z13so3195554lfe.11 for ; Sat, 10 Nov 2018 04:56:38 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h16-v6sm2145024lfc.0.2018.11.10.04.56.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IWjsVxPvjkCLCTPAbNy2vh23hN/jENwJWtqYH5GeQn4=; b=b7AMEUHhYJPvSKqRFJ6fHGII23+IE7rVJ25K4q/E/Of6c3MuZHjFejM7qZXFgb9z7u GWrhk13nYBubUvAYxgGs8s+leRONFRrLRclSkvdQnB4vry5fA/8LVfRlYkI2NKnNdUFp sSwY7lkCYReNrQYTkSU+QuRcaAqt3cSd6xQG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IWjsVxPvjkCLCTPAbNy2vh23hN/jENwJWtqYH5GeQn4=; b=Lzszj5KINxNuKiJ0DuTZ2bnfLg+u5hGs13NCNJsNXjdaP2DP5WNawT3boLwtoiy5Fm VxscqoKLzTEnE8atSNtZTTMNrx140GLGkwypHZLYHMBA4+HxcoPY/dWOJ998LVwpiFBB mQvs0CRByk2iroB6Ygpa4u6YvnIdSRGj39QWyM7EvXXwq4ucwWYwN+zfQwdVHazvYMDv /m0XtpFCuWE4Dfexejhl/soC6gQvPl0jBDMSZUvk9A6tDbQvd8d5XgiK2soHvdfVafj1 MGItqzD6GNYQOFISz9jQMfADUMGNZZivtpi8X8mJpkpPGIkTAhN3TMEUB54DmtdluNZ7 AN6g== X-Gm-Message-State: AGRZ1gIxa8D/g+k7/V9bp8FMj+YcltREP5ktEk6TDCk8F2vbxruYIFIs Y33NJstj5dVVavamn1qD9TJgZVEnZgU= X-Google-Smtp-Source: AJdET5fpgbXizX4VxrEtTjK6Un0Jibs0lYJXWJ2LqmvwPUEo+6ty4gDjcSDYy8UBJaF1erBlD/AgHw== X-Received: by 2002:a19:f89:: with SMTP id 9mr7201633lfp.10.1541854596096; Sat, 10 Nov 2018 04:56:36 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com Date: Sat, 10 Nov 2018 13:56:22 +0100 Message-Id: <20181110125624.1168-3-radoslaw.biernacki@linaro.org> In-Reply-To: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sat, 10 Nov 2018 12:56:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sat, 10 Nov 2018 12:56:38 +0000 (UTC) for IP:'209.85.167.68' DOMAIN:'mail-lf1-f68.google.com' HELO:'mail-lf1-f68.google.com' FROM:'radoslaw.biernacki@linaro.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.167.68 mail-lf1-f68.google.com 209.85.167.68 mail-lf1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 2/4] util: Code simplification 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sat, 10 Nov 2018 13:13:00 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Removing redundant sections of the code Signed-off-by: Radoslaw Biernacki --- src/util/virnetdev.c | 40 +++----------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index e55c538a29..117ec41869 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1445,30 +1445,12 @@ int virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname, int *vf) { - char *pf_sysfs_path =3D NULL, *vf_sysfs_path =3D NULL; - int ret =3D -1; - *pfname =3D NULL; =20 if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) - return ret; - - if (virNetDevSysfsFile(&pf_sysfs_path, *pfname, "device") < 0) - goto cleanup; - - if (virNetDevSysfsFile(&vf_sysfs_path, vfname, "device") < 0) - goto cleanup; - - ret =3D virPCIGetVirtualFunctionIndex(pf_sysfs_path, vf_sysfs_path, vf= ); - - cleanup: - if (ret < 0) - VIR_FREE(*pfname); - - VIR_FREE(vf_sysfs_path); - VIR_FREE(pf_sysfs_path); + return -1; =20 - return ret; + return virNetDevGetVirtualFunctionIndex(*pfname, vfname, vf); } =20 #else /* !__linux__ */ @@ -1863,13 +1845,9 @@ virNetDevSaveNetConfig(const char *linkdev, int vf, * it to PF + VFname */ =20 - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName =3D pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } =20 if (pfDevName) { @@ -2021,13 +1999,9 @@ virNetDevReadNetConfig(const char *linkdev, int vf, * it to PF + VFname */ =20 - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName =3D pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } =20 /* if there is a PF, it's now in pfDevName, and linkdev is either @@ -2226,13 +2200,9 @@ virNetDevSetNetConfig(const char *linkdev, int vf, * it to PF + VFname */ =20 - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName =3D pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } =20 =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 21:48:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541855100248706.9812937034155; Sat, 10 Nov 2018 05:05:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1898811DC; Sat, 10 Nov 2018 13:04:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5483216D5C; Sat, 10 Nov 2018 13:04:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A2135180053A; Sat, 10 Nov 2018 13:04:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAACugfG022807 for ; Sat, 10 Nov 2018 07:56:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F2D2103BAB9; Sat, 10 Nov 2018 12:56:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73AE7100194B for ; Sat, 10 Nov 2018 12:56:40 +0000 (UTC) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 075F587621 for ; Sat, 10 Nov 2018 12:56:39 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id e5-v6so3862868lja.4 for ; Sat, 10 Nov 2018 04:56:38 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h16-v6sm2145024lfc.0.2018.11.10.04.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EHR3I5uR6aRXZVSs7m0yqZL63sA3kQ6MEBnS9JX8js8=; b=BHLgzVCgQ0724dDhs17rfj6J1RsiCb7dI7G7Ts3Yd2wnD2ppgNNdzLS9PHl9f4vzXF iZBI8VcBKXair4Htl7SGujJePtB2qu09Jt51MhwLEVJetZF3xUwBw1azO8cnvampIg6i /gKwIkfL+qeiHrk9B2HfgUg00U92n+Thd3VGY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EHR3I5uR6aRXZVSs7m0yqZL63sA3kQ6MEBnS9JX8js8=; b=bJ0MYXQEYUe14lS4fBzXH/I4IYx9aTOyWRWtkcBLwhL+9SSPzl6rBGKR4U/vh9exJI SUhOBCsbu2obY4xBVfxO/5ZCRLCN/l5WxkukW1hrSeoeMVUPqoV9c5cba5F/jioDl1xf aXVMvynXpj6lw27TBqtKbfdwr3lfoXalRKvX6SVfe2pzhWWKuDoVfGrKt/mH/AEn0/Qw HMdCq0AO97tl4RFYwhx/ND1PRXr+isTRzjdzmvCbmaWWNwkWqzn31h2KBPWfSHbw5wrA 64OTvRMRFZGh7/jZ4ZJX3yGaBwp8UbL8LJrKIG0/tzEt1PYqVJB3Xd4bsi3qKdwnhM31 q1Ww== X-Gm-Message-State: AGRZ1gIzq9gHTCT8x52V2qYTs9hZEMFLuL9pi8jSSqYXPQaZ8aGHcF7x kdoCEPwojMg56QRjZ+PE9kIg178tW7U= X-Google-Smtp-Source: AJdET5edrUN/b6P1uonvAP8MxSM/KT9aAe47Mk9qzHuMPFMTaup7lgs6fETgmljRlw8wuDWp6a3/1w== X-Received: by 2002:a2e:82c9:: with SMTP id n9-v6mr7516900ljh.137.1541854597098; Sat, 10 Nov 2018 04:56:37 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com Date: Sat, 10 Nov 2018 13:56:23 +0100 Message-Id: <20181110125624.1168-4-radoslaw.biernacki@linaro.org> In-Reply-To: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 10 Nov 2018 12:56:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sat, 10 Nov 2018 12:56:39 +0000 (UTC) for IP:'209.85.208.195' DOMAIN:'mail-lj1-f195.google.com' HELO:'mail-lj1-f195.google.com' FROM:'radoslaw.biernacki@linaro.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.208.195 mail-lj1-f195.google.com 209.85.208.195 mail-lj1-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 3/4] util: Fix for NULL dereference 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-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 10 Nov 2018 13:04:58 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The device xml parser code does not set "model" while parsing
virDomainDefPtr def->nets[i]->model can be NULL while latter compares strin= gs with STREQ instead of STREQ_NULLABLE. Fixes: ac47e4a6225 (qemu: replace "def->nets[i]" with "net" and "def->sound= s[i]" with "sound") Fixes: c7fc151eec7 (qemu: assign virtio devices to PCIe slot when appropria= te) Signed-off-by: Radoslaw Biernacki --- src/qemu/qemu_domain_address.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 27c9bfb946..15d25481d8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -232,8 +232,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; =20 - if (net->model && - STREQ(net->model, "spapr-vlan")) { + if (STREQ_NULLABLE(net->model, "spapr-vlan")) { net->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; } =20 @@ -325,7 +324,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr de= f, virDomainNetDefPtr net =3D def->nets[i]; =20 if (net->model && - STREQ(net->model, "virtio") && + STREQ_NULLABLE(net->model, "virtio") && net->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { net->info.type =3D type; } @@ -634,14 +633,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDev= iceDefPtr dev, * addresses for other hostdev devices. */ if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV || - STREQ(net->model, "usb-net")) { + STREQ_NULLABLE(net->model, "usb-net")) { return 0; } =20 - if (STREQ(net->model, "virtio")) + if (STREQ_NULLABLE(net->model, "virtio")) return virtioFlags; =20 - if (STREQ(net->model, "e1000e")) + if (STREQ_NULLABLE(net->model, "e1000e")) return pcieFlags; =20 return pciFlags; --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 21:48:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541856000221725.0498001579442; Sat, 10 Nov 2018 05:20:00 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9B623083392; Sat, 10 Nov 2018 13:19:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2C285C21E; Sat, 10 Nov 2018 13:19:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BC1CC4BB79; Sat, 10 Nov 2018 13:19:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAACuhL3022818 for ; Sat, 10 Nov 2018 07:56:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 472E15D736; Sat, 10 Nov 2018 12:56:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DD325D6B3 for ; Sat, 10 Nov 2018 12:56:41 +0000 (UTC) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F1445C0587D2 for ; Sat, 10 Nov 2018 12:56:39 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id z13so3195581lfe.11 for ; Sat, 10 Nov 2018 04:56:39 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h16-v6sm2145024lfc.0.2018.11.10.04.56.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eFD9V7bbfg465fkVJVRo8f/kVX4tbBk+ZG1ldSr5ho4=; b=Du2JqTxKjWq/FYyW9b5ZyFrBihZybtufDe2BTibr3/pzy3eRpFvBmaKHHR5K54Pin0 gvffwW7Ct8FBPjRncDT1eTfZSsbOwc89uHW/GCAjJnFp8ZVs+3PmXyd0pKC7LjJzMsXB t7wx8qd2VF8bTUJtjnI2e8ne+kiKaBA2H95Uw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eFD9V7bbfg465fkVJVRo8f/kVX4tbBk+ZG1ldSr5ho4=; b=egYggBN226iOkG99mUy5PYuPYMb7/pFpjnqMqYrBig9YiZE2KOAoYY3OssoVFtf1Dp 9/OesjGgUcq4EcOMXi24aaZnFh1mIqIZsl5gopWQmRn2bnYZY+xc2E2/2cTGtlK8wtwM 3RumQqjvdxUlYCygeLBxeWT/jpiIYV6aNMNwZD4zBgd5Z/5gA6MmZHJJ7vnPwE30uzdV jnKgCdPDnSlKFOrHhNm0YYzz1Tq17umKiC16mRI3V+MaoyC8AcFNkFWews4CrVfLzWM+ +Vdbj/82Op6cUx+nd42BbiYiLfOlKQEC+wXj/K9AQb1hNrHXYM6PZ9PBQAP24qa6b/Mu JxMw== X-Gm-Message-State: AGRZ1gLnPVZpF4anOZk3eiXq9zH2UL87I+TLCLOyaaUf/AlYlKbL6Le3 O8M9R1Fs9e/3apMx/GRlf1zOSacAAxI= X-Google-Smtp-Source: AJdET5ca8oOnRxp1yZF3C/OZDrSvNQHOcZGbULw2jh+SvqPR0r9hQvlC0wAgOjHkP1tmd3/hK1qtjg== X-Received: by 2002:a19:40cc:: with SMTP id n195mr7447771lfa.40.1541854598079; Sat, 10 Nov 2018 04:56:38 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com Date: Sat, 10 Nov 2018 13:56:24 +0100 Message-Id: <20181110125624.1168-5-radoslaw.biernacki@linaro.org> In-Reply-To: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 10 Nov 2018 12:56:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 10 Nov 2018 12:56:40 +0000 (UTC) for IP:'209.85.167.68' DOMAIN:'mail-lf1-f68.google.com' HELO:'mail-lf1-f68.google.com' FROM:'radoslaw.biernacki@linaro.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.167.68 mail-lf1-f68.google.com 209.85.167.68 mail-lf1-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 4/4] util: Fixing invalid error checking from virPCIGetNetname() 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 10 Nov 2018 13:19:58 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" linkdev is In/Out function parameter as second order reference pointer so requires first order dereference for checking NULLs which can be a result from virPCIGetNetName() Fixes: d6ee56d7237 (util: change virPCIGetNetName() to not return error if = device has no net name) Signed-off-by: Radoslaw Biernacki --- src/util/virhostdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 1898f9eeb9..1d9345beda 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -317,7 +317,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev, if (virPCIGetNetName(sysfs_path, 0, NULL, linkdev) < 0) return -1; =20 - if (!linkdev) { + if (!(*linkdev)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("The device at %s has no network device name"= ), sysfs_path); --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list