From nobody Mon Feb 9 02:55:41 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=1632235851; cv=none; d=zohomail.com; s=zohoarc; b=HUK1X9fMSENklWchTFIkBUloKIHugkKl1LOY0KozqORgBpAxgVP099yLYhmf5LjyQm6l9br536KMUOb8p1FesMJShCkm0Xi4yb/YYp9NoG+LAOLHm5nd4ez+fw2lT0EXG5zsWcfnxRcV/UrzLHETiVXXrJO/M+w4fvUZJKNARTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632235851; 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=J3GBpqNJHjxvmWX+B82xptsDC/JLwx6ev2moQnT4i60=; b=l3KF9RGJqKTPYKT3I4bZGYoG74iZTzCx4Oktsgd4A8zIpzAcJUHqoWdK/Lj2OJHKDO8ejukH5OzON2Uivpg/B0dbgmq01jWtj0d4LCX7jkPuM5C8d6CLtpbJF8zg6OYmo9Rmm9CIvCAcwdp4lP6P2ZdjPygtSBW6mNdaFnArpds= 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 1632235851532253.2427664191208; Tue, 21 Sep 2021 07:50:51 -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-302-Vm5PQxP2OXSV_PcIbDz9zQ-1; Tue, 21 Sep 2021 10:50:48 -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 9D614100CCC0; Tue, 21 Sep 2021 14:50:43 +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 E69216B544; Tue, 21 Sep 2021 14:50:42 +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 EC7681806D00; Tue, 21 Sep 2021 14:50:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18LEodZY009979 for ; Tue, 21 Sep 2021 10:50:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7041D1865D; Tue, 21 Sep 2021 14:50:39 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id C85546B545; Tue, 21 Sep 2021 14:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632235850; 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=J3GBpqNJHjxvmWX+B82xptsDC/JLwx6ev2moQnT4i60=; b=AkAGu/E3g7GLOb43zJyTN2EYiIZ2Us4CAnDLGLAd+oAzVrXD472RIFiU5JkhKclXE0/tzA 6WMG0UjPlmvXrjTLimHpM2OWl0Ya5Bjwh2w36FaG+nj6kIAEx0LbN1bD6wYbhzPGVcRdJn 1s9i6F1FEVxX+0TPWBFdOKQqRbRxq8U= X-MC-Unique: Vm5PQxP2OXSV_PcIbDz9zQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/5] virCPUDefParseXML: Parse uint using virXPathUInt() Date: Tue, 21 Sep 2021 16:50:27 +0200 Message-Id: <19a0c198d90e8a5c13fb5493a081d0b9230e7317.1632235712.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: imammedo@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.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) X-ZM-MESSAGEID: 1632235853286100002 Content-Type: text/plain; charset="utf-8" There is no need to use virXPathULong() and a temporary UL variable if we can use virXPathUInt() directly. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/cpu_conf.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 1674cd6957..d31f28dfe7 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -526,39 +526,33 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, } =20 if (virXPathNode("./topology[1]", ctxt)) { - unsigned long ul; - - if (virXPathULong("string(./topology[1]/@sockets)", ctxt, &ul) < 0= ) { + if (virXPathUInt("string(./topology[1]/@sockets)", ctxt, &def->soc= kets) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'sockets' attribute in CPU topology"= )); return -1; } - def->sockets =3D (unsigned int) ul; =20 if (virXPathNode("./topology[1]/@dies", ctxt)) { - if (virXPathULong("string(./topology[1]/@dies)", ctxt, &ul) < = 0) { + if (virXPathUInt("string(./topology[1]/@dies)", ctxt, &def->di= es) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Malformed 'dies' attribute in CPU topolo= gy")); return -1; } - def->dies =3D (unsigned int) ul; } else { def->dies =3D 1; } =20 - if (virXPathULong("string(./topology[1]/@cores)", ctxt, &ul) < 0) { + if (virXPathUInt("string(./topology[1]/@cores)", ctxt, &def->cores= ) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'cores' attribute in CPU topology")); return -1; } - def->cores =3D (unsigned int) ul; =20 - if (virXPathULong("string(./topology[1]/@threads)", ctxt, &ul) < 0= ) { + if (virXPathUInt("string(./topology[1]/@threads)", ctxt, &def->thr= eads) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'threads' attribute in CPU topology"= )); return -1; } - def->threads =3D (unsigned int) ul; =20 if (!def->sockets || !def->cores || !def->threads || !def->dies) { virReportError(VIR_ERR_XML_ERROR, "%s", --=20 2.32.0