From nobody Sun May 5 05:31:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1642517662; cv=none; d=zohomail.com; s=zohoarc; b=Npxs9WlleUBfBksqobnOwi0GN44S9rDD9ls0osHKlxisqMMga+YGtDEax29tH+2RqKC6oCQbB739kQLfoMeOpbgYeXT/8TVhD7I4lPszH/4F8Rz1e+1Vs41e7pFOjT42MkUv1BOSTXIGisUSsuqeE/F4s5D++e0INLJbzHQe9fs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642517662; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=eBPJcI9jdxLWZSd213nQqUj67MlSDTZqObtAaQj7Pdo=; b=GQbM/z50LL2mz9GaF0CNAXPbHP4WwPDMwskp+ClOY5BWgIUft1GESWCrmxPQ/PcITKAQclyGFTe6Ex8XHozfF/BqamFa/NT34PxshtktwWx4BCpYF3NoR2hreFfoF3sy8FR9vU6/LuemFKxVvNUABQcFGK2pTRchcB5LrCaQ9Hc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1642517662644817.6376503351248; Tue, 18 Jan 2022 06:54:22 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-455-XN5nTdszNf2LWC2KlIdzBQ-1; Tue, 18 Jan 2022 09:54:18 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 05E37760C4; Tue, 18 Jan 2022 14:54:12 +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 BC17F79536; Tue, 18 Jan 2022 14:54: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 263481806D1D; Tue, 18 Jan 2022 14:54: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 20IEprGs019475 for ; Tue, 18 Jan 2022 09:51:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 66071753E5; Tue, 18 Jan 2022 14:51:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3CCC5DBA2 for ; Tue, 18 Jan 2022 14:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642517661; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eBPJcI9jdxLWZSd213nQqUj67MlSDTZqObtAaQj7Pdo=; b=iW/4YHx7NJeU2FACOkVPxnWAZSUSdwKqEwhKThEbZCPXCw4v4s3Fhyju7DvQ02jB4HjcmK cthp3M9/vTq3W4Upp8IFKjnLEic+ouecxzDZPA0gvJTkniraWTNk/JQdWiT/jQIciCukiW tCzSV5huYMKrijGgknFTuRGFqLTuhmI= X-MC-Unique: XN5nTdszNf2LWC2KlIdzBQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] virDomainDeviceInfoParseXML: Reject '0' value for ACPI index Date: Tue, 18 Jan 2022 15:51:51 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1642517663980100001 Content-Type: text/plain; charset="utf-8" Value of '0' is treated equivalently to when it's not provided by the user. Reject an explicit '0' provided by the user as it would get ignored. In this rare case we can make the XML parser more strict, as libvirt would never format the '' element if the index is '0' thus there are no libvirt-generated XMLs we'd not load back, as of such this is identical to rejecting it in the validation phase. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2037146 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a805f7f6a3..393f9d9478 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6786,7 +6786,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOption *xmlop= t, } if ((acpi =3D virXPathNode("./acpi", ctxt))) { - if (virXMLPropUInt(acpi, "index", 10, VIR_XML_PROP_NONE, + if (virXMLPropUInt(acpi, "index", 10, VIR_XML_PROP_NONZERO, &info->acpiIndex) < 0) goto cleanup; } --=20 2.34.1