From nobody Tue Mar 3 03:05:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1771413471; cv=none; d=zohomail.com; s=zohoarc; b=FxoC/DqhAO7Fuhdh+O7ASxPYFAV1PvXUtQc8ATdhkZ6WrN7Td2fDCy/a7CC3KnnwZhFxgFM2Eyg8YPb+OoEDPPbYF3WXbS5qUUUX3So+djc+lTYYNe2LEMVw3EAO0Ylx6eKyyz4KnbTpcbNu/c04M3ixiqxkt/FfxrBLnVBlzPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771413471; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=YRm56ay0fAy+m9EAZbPpnv818F2goawcyFNTUh9rwDM=; b=VV17pd1yUpYyGuBFT9HHZDcDuXYjVThuHUuB+AuOLnKcecffIcdg8wLmvC86dfp0bUHcOuNqklZbse/3nekxB1NbehjSYyoetYiO/p2qTUlN1bMsZmH7dLF+0GDshFtzFhv10+oTxTBU5z9xFIPrF4/csIgwoDmngt7VFxql0KA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1771413471463936.223755176602; Wed, 18 Feb 2026 03:17:51 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 8DA11418B7; Wed, 18 Feb 2026 06:17:50 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id E140E41988; Wed, 18 Feb 2026 06:17:16 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2925A3F30B; Wed, 18 Feb 2026 06:17:11 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4A3553F97E for ; Wed, 18 Feb 2026 06:17:10 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-qMkpCk2jMVWNydgDzmoQiA-1; Wed, 18 Feb 2026 06:17:02 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A2C871955D8F for ; Wed, 18 Feb 2026 11:17:01 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 04AB919560AD for ; Wed, 18 Feb 2026 11:17:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771413429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=YRm56ay0fAy+m9EAZbPpnv818F2goawcyFNTUh9rwDM=; b=VRrzndMAk2dh7nZ7K/mn4r5EqjiIlLf31FfFfwcmGzo4TrEq56NHrYkNXg23WW9WqPBEnM MFITCnVP3rUd81UNkQgBb5g5pG+tvyMbqh1F3LKSj2blXNtmfTox4lhkZKVm3Bf8JWZSRr iWPnclvYKckF9W3QIAH6rZeG7JEIMqE= X-MC-Unique: qMkpCk2jMVWNydgDzmoQiA-1 X-Mimecast-MFC-AGG-ID: qMkpCk2jMVWNydgDzmoQiA_1771413421 To: devel@lists.libvirt.org Subject: [PATCH] virpci: Report an error if virPCIGetVirtualFunctionIndex() fails Date: Wed, 18 Feb 2026 12:16:57 +0100 Message-ID: <1f84d4eb7334bb54edd706e22cd40ba86bb4350e.1771413417.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ejYOvSinHjbwMUXOPspJICeMjrp6barTiJ56Cag6eyo_1771413421 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: QDEXUGC3ATB2QYEECCXSD2IY5U623FOH X-Message-ID-Hash: QDEXUGC3ATB2QYEECCXSD2IY5U623FOH X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1771413473306154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Either an error should be returned in all error paths in a function or in none (leaving it up to caller). Well, virPCIGetVirtualFunctionIndex() breaks this pattern. Fix it. Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/util/virpci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virpci.c b/src/util/virpci.c index 78c47869ef..ca6f2e8210 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2870,6 +2870,9 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_de= vice_link, } } =20 + virReportError(VIR_ERR_INTERNAL_ERROR, + _("No virtual function index found for '%1$s'"), + pf_sysfs_device_link); return -1; } =20 --=20 2.52.0