From nobody Sun Feb 8 18:09:10 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=1666621093; cv=none; d=zohomail.com; s=zohoarc; b=f5lRWj5mHlHLQeQ8xKMJXOwmr1x/otLMNAPUV4eLzowjcC+bBvSeVRWpbGIyZbwUmQJCcZf3hYrerfMBtK5Qo6PGZH4E+siLe7Hrz+pjH8TNoM59gfLyycN9nrPNRlFHLbJRMfH/ASg0CNyzE7FaOiuGe6WvDFvPsDuzilw0P9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666621093; 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=zc2wwFwULPM4eV6PL1RnyplAaoAsnlmDRMSSLWdvRaM=; b=hPpHG9xiYJpFoiSKj5VRLS8y0erMT54GZPWqdLkCqveODI67JsAfV2xlu85YQ/JHn/Lsf0nUzQDMGLsikdR2h7H8DmDWlWOUdSyqX2enAoTJL5k4tCdLVbNArYBaZIiLKPOqYgaHjRGNILroq0FGoWx68W1ZEOj3mHz3gbTRRQU= 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 1666621093792347.1694908517658; Mon, 24 Oct 2022 07:18:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-43-EP8hEkyTNoGtG2fH-SHTHQ-1; Mon, 24 Oct 2022 10:16:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F88D2999B23; Mon, 24 Oct 2022 14:16:00 +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 1C65340C6FA3; Mon, 24 Oct 2022 14:16:00 +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 0B8121946594; Mon, 24 Oct 2022 14:16:00 +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 B229A194658D for ; Mon, 24 Oct 2022 14:15:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A516240C2140; Mon, 24 Oct 2022 14:15:58 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12B4440C2064 for ; Mon, 24 Oct 2022 14:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666621091; 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=zc2wwFwULPM4eV6PL1RnyplAaoAsnlmDRMSSLWdvRaM=; b=BfUEA8tntHmdt8xqBDbUBYLMGfLFcAXn0wYPuYs+p5/9Mk4S2r45nv2JGnkbWXduITfdew gTNEe4w2umyj35OxiwfO9UKM3u7yBiZrJ890ekfIdoThvx/67Ktop4JfunBYrRJpSXfNy4 FXgtWWG2YoeNY8d5VWCmeKSmS9Vx+ow= X-MC-Unique: EP8hEkyTNoGtG2fH-SHTHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 42/43] cpu_arm: Avoid use of 'unsigned long' Date: Mon, 24 Oct 2022 16:14:47 +0200 Message-Id: <09ef991aded35cbb0b8ff3239f4deeb906b51768.1666619795.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 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 3.1 on 10.11.54.2 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: 1666621095321100003 Content-Type: text/plain; charset="utf-8" Covert all use of 'unsigned long' to 'unsigned long long'. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_arm.c | 37 +++++++++++++++---------------------- src/cpu/cpu_arm_data.h | 4 ++-- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index 409b397155..ef72d6dceb 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -57,7 +57,7 @@ static const virArch archs[] =3D { typedef struct _virCPUarmVendor virCPUarmVendor; struct _virCPUarmVendor { char *name; - unsigned long value; + unsigned long long value; }; typedef struct _virCPUarmModel virCPUarmModel; @@ -266,7 +266,7 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC= _UNUSED, static virCPUarmVendor * virCPUarmVendorFindByID(virCPUarmMap *map, - unsigned long vendor_id) + unsigned long long vendor_id) { size_t i; @@ -312,15 +312,13 @@ virCPUarmVendorParse(xmlXPathContextPtr ctxt, return -1; } - if (virXPathULongHex("string(@value)", ctxt, &vendor->value) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Missing CPU vendor value")); + if (virXMLPropULongLong(ctxt->node, "value", 16, VIR_XML_PROP_REQUIRED, + &vendor->value) < 0) return -1; - } if (virCPUarmVendorFindByID(map, vendor->value)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU vendor value 0x%2lx already defined"), + _("CPU vendor value 0x%2llx already defined"), vendor->value); return -1; } @@ -347,7 +345,7 @@ virCPUarmModelFind(virCPUarmMap *map, #if defined(__aarch64__) static virCPUarmModel * virCPUarmModelFindByPVR(virCPUarmMap *map, - unsigned long pvr) + unsigned long long pvr) { size_t i; @@ -367,7 +365,8 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt, { virCPUarmMap *map =3D data; g_autoptr(virCPUarmModel) model =3D NULL; - g_autofree char *vendor =3D NULL; + xmlNodePtr vendorNode =3D NULL; + xmlNodePtr pvrNode =3D NULL; model =3D g_new0(virCPUarmModel, 1); model->name =3D g_strdup(name); @@ -379,14 +378,11 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt, return -1; } - if (virXPathBoolean("boolean(./vendor)", ctxt)) { - vendor =3D virXPathString("string(./vendor/@name)", ctxt); - if (!vendor) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid vendor element in CPU model %s"), - model->name); + if ((vendorNode =3D virXPathNode("./vendor", ctxt))) { + g_autofree char *vendor =3D NULL; + + if (!(vendor =3D virXMLPropStringRequired(vendorNode, "name"))) return -1; - } if (!(model->vendor =3D virCPUarmVendorFindByName(map, vendor))) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -396,19 +392,16 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt, } } - if (!virXPathBoolean("boolean(./pvr)", ctxt)) { + if (!(pvrNode =3D virXPathNode("./pvr", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing PVR information for CPU model %s"), model->name); return -1; } - if (virXPathULongHex("string(./pvr/@value)", ctxt, &model->data.pvr) <= 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing or invalid PVR value in CPU model %s"), - model->name); + if (virXMLPropULongLong(pvrNode, "value", 16, VIR_XML_PROP_REQUIRED, + &model->data.pvr) < 0) return -1; - } VIR_APPEND_ELEMENT(map->models, map->nmodels, model); diff --git a/src/cpu/cpu_arm_data.h b/src/cpu/cpu_arm_data.h index 36f1a60533..15a2c72d1c 100644 --- a/src/cpu/cpu_arm_data.h +++ b/src/cpu/cpu_arm_data.h @@ -25,7 +25,7 @@ typedef struct _virCPUarmData virCPUarmData; struct _virCPUarmData { - unsigned long vendor_id; - unsigned long pvr; + unsigned long long vendor_id; + unsigned long long pvr; char **features; }; --=20 2.37.3