From nobody Mon Feb 9 17:34:58 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=1621350348; cv=none; d=zohomail.com; s=zohoarc; b=iNSHrQICEuqXYGpl90mwi3JrnHz/imQn/VRmaJmMYKwaw8M1PE6UqlyTrjZeGq487n6JlTrWsk/qABGa4eSvofrnNa0I+tCma1YY/krSMEQRAvN79phaYY+U1cMVM24TlS1XGp7q3tv2KWXD/JIq09/Ah6XszpKyvO3xFkoNR+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621350348; h=Content-Type:Content-Transfer-Encoding:Cc: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=+TdRffC47d9sGWSprKRAD8Dc98cIhESN9OIZxKT5i3U=; b=mNBdYu0BSu9IZkKMbZJIcY8cfXOKQ5tjD5evs0eZGe3yPhRRdostFfSgfAWlJj8xsxXDQHNbhcBtLPYcBc65qFcP4nEVUKzkKtyJy0Vsp0RVlEojXBsYWGc1sAaLHvZjydebsdM8HE+BEpYUFjxoiBzDJZn+onkf7SJOnjIvqsg= 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) header.from= 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 16213503480061008.0425177984044; Tue, 18 May 2021 08:05:48 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-spCTnXNkMruFg9HV1z5_rQ-1; Tue, 18 May 2021 11:05:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49C60195D56D; Tue, 18 May 2021 15:05:36 +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 0B2135D71D; Tue, 18 May 2021 15:05:36 +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 C3FF01801267; Tue, 18 May 2021 15:05:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14IF5Atx019364 for ; Tue, 18 May 2021 11:05:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 580CEE152; Tue, 18 May 2021 15:05:10 +0000 (UTC) Received: from work.redhat.com (ovpn-113-109.ams2.redhat.com [10.36.113.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3D383CC7; Tue, 18 May 2021 15:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621350345; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=+TdRffC47d9sGWSprKRAD8Dc98cIhESN9OIZxKT5i3U=; b=aZ4jvVdB+yKaXSjcuZo/+xPpjhEFfeMz7q8d0Dxbr+0xYevPhsdyuu9e8PmqludX0op42P +0iBJVGfz996fdExx5r/jAtr2YED5OMWMiAfcEvtsvcYIAO7ZotHOb3XnDeUKlx+g2u6HX D9Txw54F9DUJGpoFpSHjRHYqfQDh+hw= X-MC-Unique: spCTnXNkMruFg9HV1z5_rQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virNodeDevCapPCIDevIommuGroupParseXML: Use virXMLProp* Date: Tue, 18 May 2021 17:04:51 +0200 Message-Id: <20210518150451.79954-11-twiederh@redhat.com> In-Reply-To: <20210518150451.79954-1-twiederh@redhat.com> References: <20210518150451.79954-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.15 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) Content-Type: text/plain; charset="utf-8" This strictens the parser to disallow negative values (interpreted as `UINT_MAX + value + 1`) for attribute `number`. Allowing negative numbers to be interpreted this way makes no sense for this attribute. Signed-off-by: Tim Wiederhake --- src/conf/node_device_conf.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 861f43f6c4..332b12f997 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1557,25 +1557,14 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathConte= xtPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree xmlNodePtr *addrNodes =3D NULL; - g_autofree char *numberStr =3D NULL; int nAddrNodes; size_t i; =20 ctxt->node =3D iommuGroupNode; =20 - numberStr =3D virXMLPropString(iommuGroupNode, "number"); - if (!numberStr) { - virReportError(VIR_ERR_XML_ERROR, - "%s", _("missing iommuGroup number attribute")); + if (virXMLPropUInt(iommuGroupNode, "number", 10, VIR_XML_PROP_REQUIRED, + &pci_dev->iommuGroupNumber) < 0) return -1; - } - if (virStrToLong_ui(numberStr, NULL, 10, - &pci_dev->iommuGroupNumber) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid iommuGroup number attribute '%s'"), - numberStr); - return -1; - } =20 if ((nAddrNodes =3D virXPathNodeSet("./address", ctxt, &addrNodes)) < = 0) return -1; --=20 2.26.3