From patchwork Sat Nov 17 19:51:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 151422 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp904259ljp; Sat, 17 Nov 2018 13:09:24 -0800 (PST) X-Google-Smtp-Source: AJdET5cYBq5PG8cdoEUumBEss8aNMw/n0BMqysx0fmCBhx9laxUdXDErVOl+HLWJebmyDJliTQth X-Received: by 2002:ae9:edd8:: with SMTP id c207mr14599146qkg.184.1542488964405; Sat, 17 Nov 2018 13:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542488964; cv=none; d=google.com; s=arc-20160816; b=rq3y/X0pdzrx2RMhJ8QbsjfZ5vGvJZ3hGYODcdx8fAzXu3DW++R8Db9VHRdm57535t FclvYqL2A1yiDW9bC899pAyeTeCLmqNZuHOzQtXRWwgP45/wffP4sB5Eq26ot6O0mX+6 il2GQBEsyypCh7suCYvzeWIwd2ZGcPpN+oUbVBUFqjvYHJRqsrnZdN6axUAZe4vnYBiH 2oFV/AZZytKYJ4cYDPzD8Hm0Yrz7ayXcEIDppPOP6rJYY/rzw/0HUwd+IQC1LFZ9iIVH O1jsCbm4jM9gMRASNyG7E5r0IdACxYb2X/0+oWkTzdwgI9DPA2EzUvmxh8sEMkI4tHIf lCYg== 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=H/v9zapIG5eRtNLAhalnbBtOj5JS3uiwGX4SCkWP+Ys=; b=wvn2+gkWvj/+LiGglRB5I+nCj2bcB993QhW7ih8VOzb4A6JbeO/8DckQWownFknFUX Bsyi473fGIEwhVLZKKlO3Vk1u7zGR6O4CR1AKfqMS+ALz618pabVKVlWPHwm+b4uBAbq WgPbKR/Zn5I2iNJPj4wGV4yzyceacbakF4kF5yuqtsxOF0CgKd4krKxV5eUMGI22/dPo +124dbY09JV3ATtn4TRXkJjrtZatPtr1LzfRe/HQSOfgQDengjD2v71pPhS4SyqLTuXy /Q7+G2/WhavKqu5IMKR/G2qDoIDIYFFMqHZ6R0+OZ6rj4K/toF02n3klqorC7zHAnA7b 0jeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AWPxVvus; 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 c4si10172260qvo.215.2018.11.17.13.09.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 13:09:24 -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=AWPxVvus; 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 78796C049597; Sat, 17 Nov 2018 21:09:22 +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 4266917249; Sat, 17 Nov 2018 21:09:22 +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 D70F93F953; Sat, 17 Nov 2018 21:09:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAHJpO33029177 for ; Sat, 17 Nov 2018 14:51:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CC3765F57; Sat, 17 Nov 2018 19:51:24 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6434365F48 for ; Sat, 17 Nov 2018 19:51:22 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 E4B2E4E916 for ; Sat, 17 Nov 2018 19:51:20 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id f23so13068181edb.3 for ; Sat, 17 Nov 2018 11:51:20 -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=V4omFcjws/Z/+/+Zs4WSRpsJOEsX4CGTL83qjq0bh2o=; b=AWPxVvusEyIM+yqwDQv4LwnBl6Mw+GLYdFFjKgzW0kd4pMMLPjneGmI79nr8fEEPLP hQXPJlRluIEtZGl/pFjECMF/szTd7O/eo1h2III//seOCxr7tByQffSMT298poAegafP teH374CalvM0Smv3Ib3X8KL+c5Z59+nXrRbXQ= 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=V4omFcjws/Z/+/+Zs4WSRpsJOEsX4CGTL83qjq0bh2o=; b=tscQ6Q3vsHIiCtSIX9Jlp0y6VghT7OaTVPXzXo0pC/KbzQRjOvemqCj8DhKBkWzrxQ JzXegWWYKzVp6QodpE3ThKvpIPQg62hZfn+3VA6J4oN4WeQiInnCSR8HOwUT5OOvqUYR JtKFtFaeNn9S8gkHIshLsmVRPpzK6keUBBMYB6q2ALjM2wRDgW2Koh9IfCRMk1RvCXED XOTSzilB/3qZUiaWwL/ysFtG/uIpdVeWbGW5VML7BUg1JtWqqO8ltAlsTNroUZ18ayGZ QAoMZTewgb/xP/2WsJRd1+e+g+9ttg0wW5vtP0KYEQmv6eNrGvU/fyFdP1eCFgsfxCkq prKw== X-Gm-Message-State: AGRZ1gKqxd8Pi1tzrVtbmT7IuqGIGORQY8b3zLtBG0ruzI2+wk171nfP Md4y9k3sD5Lu/+XBrPNAcPeP9ydHYqA= X-Received: by 2002:a17:906:1859:: with SMTP id w25-v6mr12253044eje.3.1542484279255; Sat, 17 Nov 2018 11:51:19 -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 s12sm7887633edb.43.2018.11.17.11.51.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 11:51:18 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com, mprivozn@redhat.com Date: Sat, 17 Nov 2018 20:51:10 +0100 Message-Id: <20181117195113.12544-2-radoslaw.biernacki@linaro.org> In-Reply-To: <20181117195113.12544-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> <20181117195113.12544-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Nov 2018 19:51:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 17 Nov 2018 19:51:21 +0000 (UTC) for IP:'209.85.208.66' DOMAIN:'mail-ed1-f66.google.com' HELO:'mail-ed1-f66.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.66 mail-ed1-f66.google.com 209.85.208.66 mail-ed1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v2 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.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.31]); Sat, 17 Nov 2018 21:09:23 +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. The error report was moved outside from virNetDevGetPhysicalFunction() and the error message changed slightly to reflect other potential root causes of error. 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 | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 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..f1c2ba8c17 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1358,15 +1358,8 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname) goto cleanup; } - 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); + if (!*pfname) goto cleanup; - } ret = 0; cleanup: @@ -1453,8 +1446,12 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname, *pfname = NULL; - if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) + if (virNetDevGetPhysicalFunction(vfname, pfname) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot get PF netdev name for VF %s"), + vfname); return ret; + } if (virNetDevSysfsFile(&pf_sysfs_path, *pfname, "device") < 0) goto cleanup; @@ -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 17 19:51:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 151423 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp904399ljp; Sat, 17 Nov 2018 13:09:35 -0800 (PST) X-Google-Smtp-Source: AJdET5dgTWKI7NNUk+G5kItileQjc+4rS6CX5Ufw9S0Sf8I/rN1AMoicDJYN2eOfrrrttLvXam0j X-Received: by 2002:aed:3084:: with SMTP id 4mr11232453qtf.30.1542488975165; Sat, 17 Nov 2018 13:09:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542488975; cv=none; d=google.com; s=arc-20160816; b=kS7uLUzO6JqINCgP36Ln1wEkf9Xe4Bs2Yz1N5fLh94gr8kYsriAFNwltElIvzZdYw+ disl3b2PPu2HDXNImr4mwUCT0n1Bi3u4FKFQUJh2hpbQyhPwDjCVACU5r/Vhy4vW2Rlf hwr11q/h0fyBQGkhyjj0qVsjRQRihoU65wQLlOcfD884re7aGf255GOFP1miJyWMDOqQ +X6wLypu3AKcbc7lLnsiL5+q/mO+ZZcTmYeFeIWSrcFgGJ2F3kXrHuSHsFQYrDTu5Xdc TMsqMgYd8pmvHAEZDHzdtBJiEYivEDQkehL+pwJXpOSDlO6X9U2M0Tej4M7NCJRtp6cE igrA== 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=a/7eaEHU6p0zu+7zqf0GKi/4Pbp4jKqcRK7cNQp7JXM=; b=C/KS5EP1EHaKv32Z6voTQhHhFIQdqZPzBGSdDTzoDnoVU7b+0xCBN353DrFk4UMDFt cWiyh8dotLmM1deUYgfr0mUGq/6XGWvobK5oIqXVXAOCCzv0A8plFzQ0A68NiUTcvCMs qzxHXBFSrFABO3wW9Iwo0BhsSOEp7kRrO68cmH1h7Kj28vr7EhwsvdUXAgfzxSLAAzSZ +KGbN1I6wVaxf+1G6vRHNvJ/bxsl94G3aCFWyhu1/vwRGURVgPoDU6Be6znOWyhkM9iQ EPMdXYl1jSdyapIYz7dA4CXmv8lfjdhi9KGECMQiL1IOmnF8+oRYY8W3pvaYfHc2uBMD IQvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QX11F3GT; 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 i13si1714346qvj.139.2018.11.17.13.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 13:09:35 -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=QX11F3GT; 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 826263083392; Sat, 17 Nov 2018 21:09:33 +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 51B2217249; Sat, 17 Nov 2018 21:09:33 +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 0810C18005B1; Sat, 17 Nov 2018 21:09:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAHJpOou029178 for ; Sat, 17 Nov 2018 14:51:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7022C60BF1; Sat, 17 Nov 2018 19:51:24 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6497065F4C for ; Sat, 17 Nov 2018 19:51:23 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 DA2EC3DDB6 for ; Sat, 17 Nov 2018 19:51:21 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id f4so9586466edq.10 for ; Sat, 17 Nov 2018 11:51:21 -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=kVZfDwJ2r7m+ojDZr9hYdZNb8P6V0m1xH6zGF0YyfXc=; b=QX11F3GTiuYnJpAl9JFbH+hlx/qZt0IJaKsoLRggYesMAhRtnA87op/Vq+f9/Rasvj bCPUU2lTwy20xLbqXThOrBEFwQEvDN7XRJTHw7fEoE5kesPVGAml8DwEfr1o0NVOP6xd M1cdQZUv84JmjEJdbOvpyVbrntB7wiA8O8Do4= 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=kVZfDwJ2r7m+ojDZr9hYdZNb8P6V0m1xH6zGF0YyfXc=; b=g5F2ndszmk85Bak2/IFU33fqdd0SXszlF1Toh/1gEeuYqffaUEGvgtuilS8OjxDbYm 8mxcgJ+DlRXLFN8szSmP5QVPGCYFw9aYwmLGpCABNR773cK6rgfzWxj+HF9pzZpCgpXU sLmedy77G6p9yJJw2r9eT7adF/zmzt6ubEmGVu8P+ng/3zierpc61o5Ybwl4EWJn4WLV Jm+BSq4gGbOFYt+ioi+OXA1h4l9V6uBqz8sDTZb987/mZdPeb0PcwolC/QhHgim1ONnR YZimJw34MTHazMmlj0B6yawiRe9fZCOuU8AqmnrnkmQiCinCtXgwF97xu/90/Fwlc22x DbZA== X-Gm-Message-State: AA+aEWaq0IOzC3WxyFCInF7m5KDpwz08RUMA7s3TP6IpOV9bxqZOP9WC H/ZNn/L0tf/L/XdkoAr5r6/ku1SSEoM= X-Received: by 2002:a50:b902:: with SMTP id m2mr4646682ede.108.1542484280308; Sat, 17 Nov 2018 11:51:20 -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 s12sm7887633edb.43.2018.11.17.11.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 11:51:19 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com, mprivozn@redhat.com Date: Sat, 17 Nov 2018 20:51:11 +0100 Message-Id: <20181117195113.12544-3-radoslaw.biernacki@linaro.org> In-Reply-To: <20181117195113.12544-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> <20181117195113.12544-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Nov 2018 19:51:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 17 Nov 2018 19:51:22 +0000 (UTC) for IP:'209.85.208.66' DOMAIN:'mail-ed1-f66.google.com' HELO:'mail-ed1-f66.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.66 mail-ed1-f66.google.com 209.85.208.66 mail-ed1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v2 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 17 Nov 2018 21:09:34 +0000 (UTC) Removing redundant sections of the code Signed-off-by: Radoslaw Biernacki Reviewed-by: Michal Privoznik --- 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 f1c2ba8c17..9318de406c 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1441,34 +1441,16 @@ 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) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot get PF netdev name for VF %s"), vfname); - return ret; + return -1; } - 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 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 17 19:51:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 151419 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp855052ljp; Sat, 17 Nov 2018 12:01:29 -0800 (PST) X-Google-Smtp-Source: AJdET5fAcSroflDQO/VGWIG+9LG335xNjxnWuILF/IBkr4v5tGciryIhLl3MdPM0K3Fv/BInns4g X-Received: by 2002:a37:6801:: with SMTP id d1mr14990878qkc.217.1542484889159; Sat, 17 Nov 2018 12:01:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542484889; cv=none; d=google.com; s=arc-20160816; b=XR+TShwUQIw+Uf6HmHJKJukP0DHW0n0lT9+D7/I4TtIcAuKUWdFbysXNgjpMtd1RVW nGiDzWUnkAUuQ1mAzeaVE/S7yFJEo1dQREJwfiWo+kBmtr+1AXnzKleZCqOgRdTM8Sa1 WMJV62S4posPmeangUgoFQJP3IN7P/1qxWJLhZkK++w74if+xz3CfdnSF4hdw029RIWF h1u625ERQRS+yZ3IqAS1vQSn52wkH0o8s247XCkKvgbRQ/WW/9+nDxbAaYKC2QPNxLSA nmCc72fcEqp/G2tWUojNm3gGSwE1L+aqM8QLQVqFlfHqEiGUCg09cU0swTdRJQ7rIpzT fWcg== 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=afujdvFQRQrZ9VFeV/B0ilFD5Umr8sqVVg/xx6sIjVc=; b=J2fEB8+8BJp1VQj59ckn6RRyooO0jTCZlduBBaT9vn12j+w3fQaILFuyghl9e9IH9E 2R4aChqwipeRjdaN1uhhKKfWI4oPhMaKcUMa1F7eV1XEmcQxkO2PGJoXITmjj7ADVyW5 0YcLmlgXSUwRsJne4OyxWDSMJpVmXd0Nf4xGRbBzYXWbZk6qup7R/GvT7aqt4iA6V4jg OaxDxhHlqpU4Gg8zxRwEobYTpUuxTXDMKp2Ijz4RsT+OYM47MGtoMJz7hjXFEoXbV2Xf IdsDamA9mS4l7OrA5vX6Hp/D7+ndAq9+xU0xs2hEHz96IhBujAGbvqVaIjUU8Fp7YXKK 87Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LvaQBUSv; 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 i92si503753qtd.247.2018.11.17.12.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 12:01:29 -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=LvaQBUSv; 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E661385362; Sat, 17 Nov 2018 20:01:26 +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 5A15E7D2C8; Sat, 17 Nov 2018 20:01:26 +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 14EE2181B9E1; Sat, 17 Nov 2018 20:01:25 +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 wAHJpQYo029222 for ; Sat, 17 Nov 2018 14:51:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 39514101962A; Sat, 17 Nov 2018 19:51:26 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 318A41001F3D for ; Sat, 17 Nov 2018 19:51:24 +0000 (UTC) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.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 D52E13084217 for ; Sat, 17 Nov 2018 19:51:22 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id f4so9586484edq.10 for ; Sat, 17 Nov 2018 11:51:22 -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=PxzE0LVPiDRRkOraSl4MU1fXKtt0B1+bjHE0+zgQilM=; b=LvaQBUSvO28rJ3PwODc40Q6vkOzG+IcLK2qGiFDUKHhp/kBDEDFsXwBtsl+jZLaM4E s0Ss2/niwKxxNbAJzvckfzA6ium455RtNTIhmd7MGwYpsOLFwFn5dTVf0gbFAj8dlnx6 JUtTChyA1vXpOdFgioZBQf5dMHGwDjpZFgTFg= 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=PxzE0LVPiDRRkOraSl4MU1fXKtt0B1+bjHE0+zgQilM=; b=SekShAPO6bPHCiiaLo5AD03t/aiFdyN2NJd9Ui8z8aIMtrkyJztsv7Bz84WXiFjyPa c+Jhn1Zxy9hYjkFK5/DiVktH7+T3t4fH0tMfrDKXM1lftVQ/iCJgD/jeq24oVNLWA004 ntj2UbPbYV7tpDNcgoAk/5xEsSgo0HNR+fNLzsQTDGEi/8yLQtEYZxgtj7J9V6ZkJnCF ZF/ORo5WDHKCqmqUe5xPJijvKTJny+EP5mD0kiUuUc5LdDYtMKPrwN2hO8HtNFCzgQgm zgZnPRkVw2xX80RRlm7Dqynoj1y89n+dVG8a6giJWu+N5Ubq8O/FM9X8Y9AyfVwmoTBb qtNQ== X-Gm-Message-State: AGRZ1gLeiY2VtR80QdaN+M6a6sPeR/6Su/6eJc02mncrevGy2CYFqdp9 f+wrEL4xUFmzOKUODPiCZOWHzG48mVM= X-Received: by 2002:a17:906:3389:: with SMTP id v9-v6mr11975026eja.201.1542484281110; Sat, 17 Nov 2018 11:51:21 -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 s12sm7887633edb.43.2018.11.17.11.51.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 11:51:20 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com, mprivozn@redhat.com Date: Sat, 17 Nov 2018 20:51:12 +0100 Message-Id: <20181117195113.12544-4-radoslaw.biernacki@linaro.org> In-Reply-To: <20181117195113.12544-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> <20181117195113.12544-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 17 Nov 2018 19:51:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 17 Nov 2018 19:51:23 +0000 (UTC) for IP:'209.85.208.68' DOMAIN:'mail-ed1-f68.google.com' HELO:'mail-ed1-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.208.68 mail-ed1-f68.google.com 209.85.208.68 mail-ed1-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v2 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sat, 17 Nov 2018 20:01:27 +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 Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain_address.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 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 73ed9cc68c..f9275ed810 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -232,10 +232,8 @@ 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; - } if (qemuDomainAssignSpaprVIOAddress(def, &net->info, VIO_ADDR_NET) < 0) goto cleanup; @@ -324,8 +322,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr net = def->nets[i]; - if (net->model && - STREQ(net->model, "virtio") && + if (STREQ_NULLABLE(net->model, "virtio") && net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { net->info.type = type; } @@ -692,14 +689,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 17 19:51:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 151421 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp869020ljp; Sat, 17 Nov 2018 12:17:14 -0800 (PST) X-Google-Smtp-Source: AJdET5fSqEFO1yVK+RJ7r4eS2XFAl240ZeNtSSSA9G1tRnjFXhOFyP+jVNBWIzRCN+pxgehhWa0A X-Received: by 2002:aed:306c:: with SMTP id 99mr14812660qte.61.1542485834006; Sat, 17 Nov 2018 12:17:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542485834; cv=none; d=google.com; s=arc-20160816; b=UOAKnC6s9nIODMVzqqJrVn5f90BQcqJOyhcF8DCpTVB0+ytEfEhrAkOL8t97XX8USM 0QDBrKn0Iog6l8i4H8dTywd/M/bHmkXOvawF0kObe6J6ZEKXzEiB2FLJzqVa/cbo2Ng3 XhceOSsB9XAMx8kRr31T2i2iN7wJQMogaIL1NkVd0r9YyDUqtaFviS9L8jU82gpF4d7E YzrXrdEe4sQzcKQbLVozd37wVocmEdDdaNbCv8FBC924twRZtWDHwtVEK62XtZ4S6uML Wb+tA9QIBeRZxuuEpcYWW/BX0h47emA0QaFM84MDAWzGjv9vUYk+uX31tyn5XmwaZaDG f3bA== 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=vv9a0ruZJR+f2FzHC3hmeS1yeQ2fhPwZ2C5SR5x6e2c=; b=C8FP8cUP8xKXgQK/C0pBO0JH/Qz9RPDzDFW/faEvDLgCeU2rjZwdmva/nZmx+eOQwg TIKYQi7TX7BCadvw/1ZCeRgDonWZItmRf5rDveckBp4PYY0Q1znOdC/lvdhaykuEMc+o +GDxsqjaTIR9B+xa917FXVwrm1qxNHHzqqoxJkJaHjOceUcxThZYz48DXeBx8e2IGFmm guPZYw1SDLhqiGqME4YqqER3poQ1l0eulaipo/iQxY3jL+8NT28YwsHYYHcRcTGXu7HP KlaSabJ/6x/KASw739ejpssFgGgzSPw1+R0WP+qrB94/M6+Pja9AOX5tMmVyiWoN77xL 4ypQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="Qy7/M8OY"; 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 e35si3466007qve.41.2018.11.17.12.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 12:17:13 -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="Qy7/M8OY"; 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-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A62BC057F34; Sat, 17 Nov 2018 20:17:12 +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 E925C600C7; Sat, 17 Nov 2018 20:17:11 +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 8199F3F7D0; Sat, 17 Nov 2018 20:17:11 +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 wAHJpR5e029355 for ; Sat, 17 Nov 2018 14:51:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6FDA2600C7; Sat, 17 Nov 2018 19:51:27 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65EDF600C4 for ; Sat, 17 Nov 2018 19:51:25 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) (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 D119E308338E for ; Sat, 17 Nov 2018 19:51:23 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id f23so13068222edb.3 for ; Sat, 17 Nov 2018 11:51:23 -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=N8DwdroMPmJovv46TwQEeDs2zfJZzOXJ9PxmkNmnvGY=; b=Qy7/M8OYy+cWICMTmCCTBjSMAOWdNVe6087ehHHjeMPYh0IMClzM6nk6hThx+bYw02 9sAt4Okl8TLsYkQZ9YbowIffZrpLGLRQKF7Ug9AW7OaoagAauZhTHDjfslhX5A1UkHmW M71ikS0qufA3hPcBaGLnWM37tN/Xz+UmXCj1c= 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=N8DwdroMPmJovv46TwQEeDs2zfJZzOXJ9PxmkNmnvGY=; b=baF2WzvqiwL4KOQb1Eb1K+2yA6dwg55dri2zcSoE/sxPxKwvm4h7kj4Aj0fMWjs+zn a11PnLwsC/ftnMuehDCLMK58h5khPOScjWtWARYDB9mMddvmRb3nATw3gmvG7FC1+uIx iKC0J/O4o+VtV59xNx16EJL/2fooCTV6THLbiMxWftr1o+ynXnPf8sjaCA0ruhezcpT5 QCDiitKM5eorMVpJaSSb7kz55W0dNuw967RSoZSsCbxdyCmOOuKEbqx5KB4HymExQ23B 2S+R8LHxsI7hz6C1vcmm1YKjCVY5mTQ/yJbDwwo2BCGYjEytE28OxemPASEzctHdyahr xr6w== X-Gm-Message-State: AGRZ1gJHCXToMIJURLWppqbZYxLQnh0r2xh0b4dzc2Pe+qzBWLv2YeyS 7uxlb0Xx/cC25m280ll99+umgc5wYTo= X-Received: by 2002:a17:906:e0cb:: with SMTP id gl11-v6mr5473514ejb.92.1542484282237; Sat, 17 Nov 2018 11:51:22 -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 s12sm7887633edb.43.2018.11.17.11.51.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Nov 2018 11:51:21 -0800 (PST) From: Radoslaw Biernacki To: libvir-list@redhat.com, mprivozn@redhat.com Date: Sat, 17 Nov 2018 20:51:13 +0100 Message-Id: <20181117195113.12544-5-radoslaw.biernacki@linaro.org> In-Reply-To: <20181117195113.12544-1-radoslaw.biernacki@linaro.org> References: <20181110125624.1168-1-radoslaw.biernacki@linaro.org> <20181117195113.12544-1-radoslaw.biernacki@linaro.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 17 Nov 2018 19:51:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 17 Nov 2018 19:51:24 +0000 (UTC) for IP:'209.85.208.66' DOMAIN:'mail-ed1-f66.google.com' HELO:'mail-ed1-f66.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.66 mail-ed1-f66.google.com 209.85.208.66 mail-ed1-f66.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH v2 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 17 Nov 2018 20:17:12 +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 Reviewed-by: Michal Privoznik --- 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);