From patchwork Sat Nov 10 12:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 150735 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1034822ljp; Sat, 10 Nov 2018 05:12:50 -0800 (PST) X-Google-Smtp-Source: AJdET5fyFSXi0B5YMvhGRYIM8cQO3IUsU7houSPHh2XDj61a0ZDMCoulH4wokjU4UCXvRVeA9oYy X-Received: by 2002:a37:bf46:: with SMTP id p67-v6mr12335652qkf.46.1541855570309; Sat, 10 Nov 2018 05:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541855570; cv=none; d=google.com; s=arc-20160816; b=BMb4Usquhkc5s4WpQidPqMlKvT1+3mMx0WpEpxaJV5vIu4g4xB3iDN+/1ZUgzX+y4J 4/TbMZfjrOLIRI1FYDds4rgHqCxGbWETlJ8aLzREXHvzRo/ekk+dO8wKGgE7pBg9Jwji 00JW74jh0SnNSjlM0xyVOmHkPk7myai3ItduCr+JgcQXm/2k2SZrUbKYr3GBxIvfPejf CY6IcAOf/clzffGTd0s56ekiJppXDzxlB0+k8nqTlf+UHRXQghtvjeQEvPjbAiFVr7vq +GG2rH35CVt2EAK8C8TN/C+cGUJJL80Fhtox9s2D+YYTecPF0GdqZmBZplVSOUVl4v82 bvgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=GOfvukbM4KHdPirpRQoJY5BiVHrl9cHb2JJhRZ3ehUQ=; b=lRpdKymaWsXHpjOtD4POCKa1I48FCN7ZXun5hJY7OIdhDEnhs9W914zhfxXB4erUy/ RYqGH+8U1N3Vs4s8U7m2amj8wQDD9vYJY3uMv7XbghQe2Ur98liDrcQoXsstPBC8xmdt rHN7PhqZnXg8Ib9VPzPFLJD5DtAIHkeKMW8NIT0w5YVirYcr2ivJ3gSfo157CgZooCwq DkgR8yXdL9Lfvfgj0nNYRDOOsW8wUL5WWtB9FrQpJD/iW9qKZUSCSdcvjCQ1L3ygMrgy 2IDdxFLqmTKO+MTTRR+yOTCMX4/p83Tf8/FHQGtdN366U2/3IpSAEuiyn3rkEnH1uy0T YXSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kc4Q15pY; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id l2si2068162qtj.22.2018.11.10.05.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 05:12:50 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kc4Q15pY; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) Delivered-To: libvir-list@redhat.com 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) 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-Received: by 2002:a2e:2416:: with SMTP id k22-v6mr8491973ljk.80.1541854595078; Sat, 10 Nov 2018 04:56:35 -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) 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 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) 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(-) -- 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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) } 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 name"), ifname); @@ -3182,8 +3179,11 @@ virNetDevSwitchdevFeature(const char *ifname, if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0) return ret; - if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0) - goto cleanup; + if (is_vf == 1) { + /* ignore error if PF does noto have netdev assigned + * in that case pfname == NULL */ + ignore_value(virNetDevGetPhysicalFunction(ifname, &pfname)); + } pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) : virNetDevGetPCIDevice(ifname); From patchwork Sat Nov 10 12:56:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 150736 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1035014ljp; Sat, 10 Nov 2018 05:13:01 -0800 (PST) X-Google-Smtp-Source: AJdET5de945MwzJwkld7FH1Ik29n3erhaTrijdjdk7Ep1BWTWIMoHGBz5LN6FP9l8m/T5/VEsrH/ X-Received: by 2002:aed:2539:: with SMTP id v54mr12158115qtc.211.1541855581883; Sat, 10 Nov 2018 05:13:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541855581; cv=none; d=google.com; s=arc-20160816; b=pPPpFQYAqzlJsebXKPDL87pvC921M7ZYKzTeqF2V2o5ND3hD6pTP7eOHsDNod/+c6S KOGf0oxlG5DooyMnBm2jFyFNtyFiX+3JDxNpcJO8jIjkO6Qg7la8k1D10iiuJzGYBYht 7fOk8XoyWuNCOE5t78O2UuH5gRXlY694uqQW0Rc003ABLh+2x2D92j8MaVQyiYwq6Vk3 u4H5J0m1AeRO9keKmYacqfP9nQod4qv/yrvWcWoYgpZvoEErc6jhE0AfxnQrMna1MNrz 9fnniJq39GdPJPBEE0P5u35UgpZA487f5ruT4oB+4W25dhAxn2INnwWvlrCO3RjTryDe 5YDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=jlsp0xJgxWF5fDgHZTa02X8K7OzLvYnSCnrnLNM2pQo=; b=gqxztsQDBYvWJSUpoNXvJJGjA7YuX3PFz15LIo7D+NmzCHwW++chHJX2rycbBB5QgI 29C7sMUezQNCZRv4aBALnCSMbVHf9UgygSQbe08nVUb5ddtM/uV6xb8DsJkLyXq/N75x G6xLLga5ZoKajomJn/4ZIa0xtU6fufEkosGFI8y2zcGCun0zeI/F7c4YAyyECxBcw0kQ idlXraIejugwAZGp1jWFy73B+93GuD0qRDD829X5AgRgHI8kyrJGh1EluX0k3SFQRq9D 2lH7WmVWywD8FcGzkPCwFroi/Aapmr4eqUB3vM1NE/YX+CiiVH8EsJLBv8i6qD4Qvqi3 IFSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b7AMEUHh; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id d4si2990801qvn.7.2018.11.10.05.13.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 05:13:01 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b7AMEUHh; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) Delivered-To: libvir-list@redhat.com 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) 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-Received: by 2002:a19:f89:: with SMTP id 9mr7201633lfp.10.1541854596096; 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.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:35 -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 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) Removing redundant sections of the code Signed-off-by: Radoslaw Biernacki --- src/util/virnetdev.c | 40 +++----------------- 1 file changed, 5 insertions(+), 35 deletions(-) -- 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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 = NULL, *vf_sysfs_path = NULL; - int ret = -1; - *pfname = NULL; 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 = 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; - return ret; + return virNetDevGetVirtualFunctionIndex(*pfname, vfname, vf); } #else /* !__linux__ */ @@ -1863,13 +1845,9 @@ virNetDevSaveNetConfig(const char *linkdev, int vf, * it to PF + VFname */ - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName = pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } if (pfDevName) { @@ -2021,13 +1999,9 @@ virNetDevReadNetConfig(const char *linkdev, int vf, * it to PF + VFname */ - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName = pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } /* 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 */ - if (virNetDevGetPhysicalFunction(linkdev, &pfDevOrig) < 0) + if (virNetDevGetVirtualFunctionInfo(linkdev, &pfDevOrig, &vf)) goto cleanup; - pfDevName = pfDevOrig; - - if (virNetDevGetVirtualFunctionIndex(pfDevName, linkdev, &vf) < 0) - goto cleanup; } From patchwork Sat Nov 10 12:56:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 150733 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1026661ljp; Sat, 10 Nov 2018 05:04:59 -0800 (PST) X-Google-Smtp-Source: AJdET5daZdeYHPRscrBKIBPHbjlkI4L5koxk6FOlj8nOdon50E4MUx0GVkxcuRsEQNNNc7KCJeRU X-Received: by 2002:ac8:6949:: with SMTP id n9mr5753402qtr.308.1541855099668; Sat, 10 Nov 2018 05:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541855099; cv=none; d=google.com; s=arc-20160816; b=L8LqSkOH+kO/W2okoIycH9ilskhANvtnLFvP/+kDF0Fyy+H2Fn9s2hrMCjFlV64BMk t8rtwruFEACwPUJEOf54BA45WXnOIH1k53cgggVEDxPF2kpZnqAyUoEDJqYyr3xhv0Si G8uBnMkDaI3OFoobSZz0xXO6uujX4WQmZJZz8ZcKHFct3YAPf5IZUVaCUgXWW9zvymLe IbxaNmqDIAvzFRmwoRStEEkgfK2v7Ts7zA7UTR2NZfBxNHPzTCVbzNGBXmYvU0QUO12I EV1D+pmO7vCklc1J0LoWgqDLKWdDQGYO1Mwv1GOUGFyuz074v/FD+4VAltVxZZD8wyP9 Bo+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=CtrxUGPa6icLSFVNwnk0vse0VI75oFNO4KlsNpguOwU=; b=Iaq0wuv9bD3Kp1DtF5sTqYPlp+dvakJN/IkovrtxnygAR8Hx96scn9ku60pNKCyjwa wr2I3eavD1ReUVdFeCXrSodR0LQFFQoQj5NclIaTuUAqX8RyaAS7VeyIKskpnefQeSEO u+4K5xwCGgF3TAKbGwWYWBLyAxqd9T4H96Yx3MWd79M2yQOQ3CEkWjT1TzXChd6TugX7 rqEgd+2ij6h+UPkvl9jOy3oeAsSMvsluGJ+G7CzSKmJZ13pbhi127gAEu9UdhB9ltrtQ /txld6yH9EaH8aIMC8dRLSS6/fpDbkIfD3PfZMWgCzXV3p2bpo50AQCtnfklcA5Fb4CH f8Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BHLgzVCg; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id u38si1922042qtk.133.2018.11.10.05.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 05:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BHLgzVCg; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) Delivered-To: libvir-list@redhat.com 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) 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-Received: by 2002:a2e:82c9:: with SMTP id n9-v6mr7516900ljh.137.1541854597098; Sat, 10 Nov 2018 04:56:37 -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) 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 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) The device xml parser code does not set "model" while parsing
virDomainDefPtr def->nets[i]->model can be NULL while latter compares strings with STREQ instead of STREQ_NULLABLE. Fixes: ac47e4a6225 (qemu: replace "def->nets[i]" with "net" and "def->sounds[i]" with "sound") Fixes: c7fc151eec7 (qemu: assign virtio devices to PCIe slot when appropriate) Signed-off-by: Radoslaw Biernacki --- src/qemu/qemu_domain_address.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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 = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; - if (net->model && - STREQ(net->model, "spapr-vlan")) { + if (STREQ_NULLABLE(net->model, "spapr-vlan")) { net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; } @@ -325,7 +324,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, virDomainNetDefPtr net = def->nets[i]; if (net->model && - STREQ(net->model, "virtio") && + STREQ_NULLABLE(net->model, "virtio") && net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { net->info.type = type; } @@ -634,14 +633,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, * addresses for other hostdev devices. */ if (net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV || - STREQ(net->model, "usb-net")) { + STREQ_NULLABLE(net->model, "usb-net")) { return 0; } - if (STREQ(net->model, "virtio")) + if (STREQ_NULLABLE(net->model, "virtio")) return virtioFlags; - if (STREQ(net->model, "e1000e")) + if (STREQ_NULLABLE(net->model, "e1000e")) return pcieFlags; return pciFlags; From patchwork Sat Nov 10 12:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 150737 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1041367ljp; Sat, 10 Nov 2018 05:19:59 -0800 (PST) X-Google-Smtp-Source: AJdET5dXmPoDo3uIykFzocmPtjgAenlo56BwR66KLgnEWLYNslP3CfS7CkjHjUwI2IWfEdPftuEZ X-Received: by 2002:ac8:2211:: with SMTP id o17mr12675367qto.170.1541855999660; Sat, 10 Nov 2018 05:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541855999; cv=none; d=google.com; s=arc-20160816; b=GQr0lRsC/gKxZKqEIba+ZvzLvJbwFDtXGXO83/lEZISDt00OZE2Q9tXMOsh9c4BdtP kZheLKNpDtQGNZB7a7369GfWR/Xcu8nmIJyQLJW355zyzEgKLk+nWmGfoYy3wqWk3Fqn iRU1gieGT+WAMVmJ63OVBE9jKFe+MyvL7CLcIXRHSc3Map6Bq6pb44enhTajIJ70EBQ9 jPQUI90HgF3jHE1JJBjv6FXgpbwoy8YaTtIb1ydA/Kfq7CZTEI3EQ7F1PnntnKYofZAO nc1ETB9xGB0NZsJ/J7NrHNipP1ugB8jNBPXL/w0mGJjd3QmBD+kWBrxam8nCYGuWcVoe V88Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Dj776dMmyQWTQrjjHNBGDAbpZYVXe4ULOd0v6twuo/o=; b=KMgLW+phnwavIH7UZxuBhdsVPV1ahneH88Sy/Trn0xQCP6qcU9qK13xDOT6v3eI+ni J0zj5wcoAQhaQS1zFm/F/gbZJdXP4UnkCI/fQwiEbWN/ow9qDOeN5Z+1X9pAOMYZStGn +U9k4cPckzvKM4wn1xqRhZVzM55TUuaHudbr8IT2QtwC1HmGOL2X8cdxejENWBYZDA0H JgaYhGH98YcBDBahokHtNrdiV/qnfvpy2nnxkQtyf6WHh4DLCHTrZVYrRhExU9o4isUE s3eE7aF3xmEagdMWv1hv8UZgRX4HSOQevFEoqZ8t0LRcbSU3OxdWGWMuesPga/eurZUm 2Aug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Du2JqTxK; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id z129si3057759qkb.241.2018.11.10.05.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 05:19:59 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Du2JqTxK; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) Delivered-To: libvir-list@redhat.com 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) 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-Received: by 2002:a19:40cc:: with SMTP id n195mr7447771lfa.40.1541854598079; 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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Nov 2018 04:56:37 -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 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) 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(-) -- 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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; - if (!linkdev) { + if (!(*linkdev)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("The device at %s has no network device name"), sysfs_path);