From nobody Mon Feb 9 02:51:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661516423; cv=none; d=zohomail.com; s=zohoarc; b=gqO13RBe5bh29kHSvifKiAAfqg18qGcuBMdmaMWL/z+OHbDUhk3EdBWy1v258pRtV1uOyW8I7BCN2+LH1p8deoAdo8mK1a8QahtzuhAX9xdGpZwJ5vc07CshnHweWA29ayrJLJn2RTWZeZUhXLpUcmad+t6m3gBmu1WWT7FeU/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661516423; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9U4F7rxKPpUGAEjEYpzjaCp2J4y2tesjSPymK1zMtVY=; b=Y/JR/lkQx8uWRV1txdnVlB3y1To5UK4VGkJe7A5qp6YIL/aCvD2jbt9cmGGjzCRHAE4vEM0BEIqxmjFIiErMsp4R99FCRcLlCL+EKF4phJf/qB3HnebzX/fUK/j08YkTi/bqOdI+uA7IZimjBPYF6DZCEKv066z73ZPoWqFxqrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16615164236481017.6604919338729; Fri, 26 Aug 2022 05:20:23 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-672-7QKjmo4JM8WefxXVO7_h5A-1; Fri, 26 Aug 2022 08:20:18 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F28F3811E76; Fri, 26 Aug 2022 12:20:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFFEA492C3B; Fri, 26 Aug 2022 12:20:15 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D16751946A5B; Fri, 26 Aug 2022 12:20:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 57BBF1946A43 for ; Fri, 26 Aug 2022 12:20:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 48AAC400EA8F; Fri, 26 Aug 2022 12:20:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB89B40E7F28 for ; Fri, 26 Aug 2022 12:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661516422; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9U4F7rxKPpUGAEjEYpzjaCp2J4y2tesjSPymK1zMtVY=; b=XmTd8H7m28SisgcIpvhUAbYWW7Jem13ZsJoSuC32FqEynfdFJ8V9aiTuUqpWZkXYCTHhMf DLzFWg6OZu6u3hzEDRHAJo1S0zqeo621Zzu/msD/YuWvXMgJaTaeYBWnJ97omOY4YT4kn+ 2mWPl8ZHVdr4yCmiNixRNSFxtKz6C7I= X-MC-Unique: 7QKjmo4JM8WefxXVO7_h5A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/10] virDomainControllerDefParseXML: Fix broken error reporting when parsing 'index' Date: Fri, 26 Aug 2022 14:20:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1661516424538100001 Content-Type: text/plain; charset="utf-8" The code attempted to report an error if the user added the 'index' attribute to the 'target' element, but neglected to actually return an error code. Fix it by using the VIR_XML_PROP_NONNEGATIVE flag for virXMLPropInt which refuses user passed negative numbers. Fixes: 020dd80ecbd Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3ff9fffba8..a9a2afc7f1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8233,15 +8233,10 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, &def->opts.pciopts.hotplug) < 0) return NULL; - if ((rc =3D virXMLPropInt(targetNodes[0], "index", 0, VIR_XML_= PROP_NONE, - &def->opts.pciopts.targetIndex, - def->opts.pciopts.targetIndex)) < 0) + if (virXMLPropInt(targetNodes[0], "index", 0, VIR_XML_PROP_NON= NEGATIVE, + &def->opts.pciopts.targetIndex, + def->opts.pciopts.targetIndex) < 0) return NULL; - - if ((rc =3D=3D 1) && def->opts.pciopts.targetIndex =3D=3D -1) - virReportError(VIR_ERR_XML_ERROR, - _("Invalid target index '%i' in PCI control= ler"), - def->opts.pciopts.targetIndex); } } else if (ntargetNodes > 1) { virReportError(VIR_ERR_XML_ERROR, "%s", --=20 2.37.1