From nobody Mon Feb 9 11:17:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494351834276197.01479844545395; Tue, 9 May 2017 10:43:54 -0700 (PDT) Received: from localhost ([::1]:38664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d89Av-0003pZ-2P for importer@patchew.org; Tue, 09 May 2017 13:43:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8969-00083F-9U for qemu-devel@nongnu.org; Tue, 09 May 2017 13:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8964-0004QQ-Ez for qemu-devel@nongnu.org; Tue, 09 May 2017 13:38:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52586) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8964-0004QL-8M for qemu-devel@nongnu.org; Tue, 09 May 2017 13:38:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E9725448D73 for ; Tue, 9 May 2017 17:38:50 +0000 (UTC) Received: from localhost (ovpn-112-26.ams2.redhat.com [10.36.112.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC76B94C79; Tue, 9 May 2017 17:38:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E9725448D73 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=marcandre.lureau@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E9725448D73 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 9 May 2017 20:35:51 +0300 Message-Id: <20170509173559.31598-10-marcandre.lureau@redhat.com> In-Reply-To: <20170509173559.31598-1-marcandre.lureau@redhat.com> References: <20170509173559.31598-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 May 2017 17:38:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 09/17] qnum: fix get_int() with values > INT64_MAX X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that the visitor has been switch to use qnum_uint, fix the bad get_int() to use get_uint() instead. Remove compatibility code. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/acpi-build.c | 2 +- qobject/qnum.c | 4 ++-- tests/check-qnum.c | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ec3ae7fa85..767da5d78e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2585,7 +2585,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) if (!o) { return false; } - mcfg->mcfg_base =3D qnum_get_int(qobject_to_qnum(o), &error_abort); + mcfg->mcfg_base =3D qnum_get_uint(qobject_to_qnum(o), &error_abort); qobject_decref(o); =20 o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); diff --git a/qobject/qnum.c b/qobject/qnum.c index 2f87952db8..be6307accf 100644 --- a/qobject/qnum.c +++ b/qobject/qnum.c @@ -76,8 +76,8 @@ int64_t qnum_get_int(const QNum *qn, Error **errp) return qn->u.i64; case QNUM_U64: if (qn->u.u64 > INT64_MAX) { - /* temporarily accepts to cast to i64 until visitor is switche= d */ - error_report("The number is too large, use qnum_get_uint()"); + error_setg(errp, "The number is too large, use qnum_get_uint()= "); + return 0; } return qn->u.u64; case QNUM_DOUBLE: diff --git a/tests/check-qnum.c b/tests/check-qnum.c index 9a22af3d0e..8199546f99 100644 --- a/tests/check-qnum.c +++ b/tests/check-qnum.c @@ -107,11 +107,10 @@ static void qnum_get_uint_test(void) error_free_or_abort(&err); QDECREF(qn); =20 - /* temporarily disabled until visitor is switched */ - /* qn =3D qnum_from_uint(-1ULL); */ - /* qnum_get_int(qn, &err); */ - /* error_free_or_abort(&err); */ - /* QDECREF(qn); */ + qn =3D qnum_from_uint(-1ULL); + qnum_get_int(qn, &err); + error_free_or_abort(&err); + QDECREF(qn); =20 /* invalid case */ qn =3D qnum_from_double(0.42); --=20 2.13.0.rc1.16.gd80b50c3f