Received: by 2002:a0c:cd0f:0:0:0:0:0 with SMTP id b15csp2732414qvm; Mon, 20 Jan 2020 02:43:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzm+IcotRz6zyF5Zq1AtF96tKRox6EOy/gafAotNb3hTTmojb3nmfrYg2i7Y6clo8vqp9d+ X-Received: by 2002:a05:620a:b18:: with SMTP id t24mr50044537qkg.341.1579517037432; Mon, 20 Jan 2020 02:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579517037; cv=none; d=google.com; s=arc-20160816; b=vy79LM5BUmLeacB8aLuhcT8414ByHT/vUhHkfE05Lh8Fi80EUdSldnVLjV7eLyDk+V 5Z57+1mSKhXhPDn2m5udOnDLfmVKrExVyEac1XPt9QWtgDY/i1Wmln9ri1kC5bxkDoup PN1uhfTKEzil5h79e8bPnXmPQSgVLeET4ett+wF0V4/y3IpCgFGutkOTNB85jSjHslCF iCVjMUGB53999fI9EjIRtORgXqkK8Q4tEamPRNp5pQHPZbQ3FEFNdOxGSEMOxKWuWyLq G+6ATi/LCwFbgBBS61dAXUqe5cSVmZJDJZ6IZOUvB7+nhpbXAE/YFZe0AOAp14cUgR7z D5kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=YenyR+cDlGnKbLpY/elkWxAa8k3PezuARzjo1X24+Yw=; b=u0Ggw+SHM31KYcEbpNSW2P5bqGvBeZB3DrmRl8uv8euKup/8RcY9QCRnTa062oGcw9 HuVMbNPHoyBB/q/BgxIyVkUxAc+K9svbM1b6/WwmwjgszA1jJgaGVRT7kkT/c5nm+Yls b77NcLwzOC144ZN5LrNTd4qhW+GhywTLi5LJT2/Oc7i/03mnTeX+9hetyUPaXe1tDy6Y PAtulqlGavAmpitLX2KtLTvrTvWhPWgWn67EO27xD0Z59zzGWCJnq5O+C7y5lRS8AWFq ore+gWWVOnvfTp1JjcTCa7dH8o0anjVYKLHlYRrkQbmQf0StwVY2APPs2pR6MlYiJjFx Hedw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=H7WOHDLp; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c18si19655685qkc.333.2020.01.20.02.43.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Jan 2020 02:43:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=H7WOHDLp; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:33800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itUXE-0008Ap-1V for alex.bennee@linaro.org; Mon, 20 Jan 2020 05:43:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37387) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itUOf-0004sq-4E for qemu-arm@nongnu.org; Mon, 20 Jan 2020 05:35:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itUOb-0001wv-HH for qemu-arm@nongnu.org; Mon, 20 Jan 2020 05:35:04 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33284 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itUOb-0001vw-C3 for qemu-arm@nongnu.org; Mon, 20 Jan 2020 05:35:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579516499; h=from:from: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; bh=YenyR+cDlGnKbLpY/elkWxAa8k3PezuARzjo1X24+Yw=; b=H7WOHDLpVRcpiPBS3gA0+9MPvRRVZr93G9b9m5AfpdNqTmvznNzmDbjmS+4+6Z3D1uojfi F7+j0oSq0+H4NfMVdg5DoIg1DBBBfjDVS6mcu1KbI4yfBvF8UdYeIycPHMtqdcRDb5bb/N xiLFJP9LPH9aUUtL5cXekOFqi0mcrtc= 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-365-oYAPs8IuOa6gae4BL12fEQ-1; Mon, 20 Jan 2020 05:34:58 -0500 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 10699A0CDB; Mon, 20 Jan 2020 10:34:56 +0000 (UTC) Received: from secure.mitica (ovpn-116-207.ams2.redhat.com [10.36.116.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 871D4860E5; Mon, 20 Jan 2020 10:34:43 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 08/29] migration: Fix incorrect integer->float conversion caught by clang Date: Mon, 20 Jan 2020 11:33:19 +0100 Message-Id: <20200120103340.25118-9-quintela@redhat.com> In-Reply-To: <20200120103340.25118-1-quintela@redhat.com> References: <20200120103340.25118-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: oYAPs8IuOa6gae4BL12fEQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 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: 207.211.31.81 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , "Michael S. Tsirkin" , Jason Wang , Juan Quintela , Peter Maydell , Markus Armbruster , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , Andrzej Zaborowski , Laurent Vivier , Thomas Huth , Eduardo Habkost , Stefan Weil , Richard Henderson , "Dr. David Alan Gilbert" , qemu-arm@nongnu.org, David Gibson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Fangrui Song , qemu-ppc@nongnu.org, Paolo Bonzini , Stefan Berger Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: fOrQF+zFq0Pv From: Fangrui Song Clang does not like qmp_migrate_set_downtime()'s code to clamp double @value to 0..INT64_MAX: qemu/migration/migration.c:2038:24: error: implicit conversion from 'lo= ng' to 'double' changes value from 9223372036854775807 to 92233720368547758= 08 [-Werror,-Wimplicit-int-float-conversion] The warning will be enabled by default in clang 10. It is not available for clang <=3D 9. The clamp is actually useless; @value is checked to be within 0..MAX_MIGRATE_DOWNTIME_SECONDS immediately before. Delete it. While there, make the conversion from double to int64_t explicit. Signed-off-by: Fangrui Song Reviewed-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 [Patch split, commit message improved] Signed-off-by: Markus Armbruster Signed-off-by: Juan Quintela --- migration/migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 27500d09a9..f79d0bf89a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2035,11 +2035,10 @@ void qmp_migrate_set_downtime(double value, Error *= *errp) } =20 value *=3D 1000; /* Convert to milliseconds */ - value =3D MAX(0, MIN(INT64_MAX, value)); =20 MigrateSetParameters p =3D { .has_downtime_limit =3D true, - .downtime_limit =3D value, + .downtime_limit =3D (int64_t)value, }; =20 qmp_migrate_set_parameters(&p, errp); --=20 2.24.1