From nobody Tue Nov 4 19:05:50 2025 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.zohomail.com; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530340905543689.8964618798873; Fri, 29 Jun 2018 23:41:45 -0700 (PDT) Received: from localhost ([::1]:45825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ9Zo-0005bt-S3 for importer@patchew.org; Sat, 30 Jun 2018 02:41:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZ96a-0004hE-OU for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZ96V-00034T-Pp for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:32 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:35835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fZ96V-00032e-JO for qemu-devel@nongnu.org; Sat, 30 Jun 2018 02:11:27 -0400 Received: by mail-wm0-x22c.google.com with SMTP id z137-v6so3958931wmc.0 for ; Fri, 29 Jun 2018 23:11:27 -0700 (PDT) Received: from donizetti.lan ([82.84.124.111]) by smtp.gmail.com with ESMTPSA id 24-v6sm563454wrz.94.2018.06.29.23.11.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jun 2018 23:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AYeDQa9x4KUNBfhIJpOWL466AgJUKMTAwe4h8IAyZyo=; b=dFdNoj2GPxrp5kn9BYEdbc3e+ND87arRbgRoZTb8M37RTL4lIsn6my7/zaKMzMeieE qOG/zDezwIyyZ66AfE7e5CdFQQgUkTGU4BDFl8QJtTqGWF3kYZvd0vPGElBp9XZQfDj3 bdgEYOSZcAphHwfVVQEjNBHdD3hy5h5uy7uFfbHeOESP+2Z0bbR+ZaWF3aWHBqaTvc7/ ioevT4+mUf11rvE0FzPH5aV+zxjUv6S2jScC9iDDJ+tuKr3+1OxebIsvO64giKLgwNYQ uxz4rwu19ojXHydw8ZU0B3NJr1SmkqkH2nwR3570RWCpjq2BQ2gaIyXsdrDu4q3NInDP Qbiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AYeDQa9x4KUNBfhIJpOWL466AgJUKMTAwe4h8IAyZyo=; b=oNodAiPUvnG6psiicErhv+DBh1Cdp32KpXGQQfLGiGFudawlCYL+vlCArdGj0DSgAx 38Up8Mp9tMxUJEO02PA2j6rZK4Roq4FqjbrwLhy0ur/9cxFU1i69MJRlhv8kP0I8bRtZ 1F0USB5SGRCQ61BWU/Ro8nZRuY/pkpSXWvDRUbR3Y2umiESMnsjrGzoJ+iuE6YMSIPya tsSOW98yliUWG7+xm2iDUOhOWI8NhsgHYdsHj4RZVZqkQHCq2fyJjwcRTuf4WIDClVP8 Z8djRJZvJ1yjiiw5qk/ovqmccfxVIZDH02xpXy+RFuZ6ZSIX4QN0/6PO7bzdHRafRkFc OGBQ== X-Gm-Message-State: APt69E1ykcMzrhzm9q8xZTwXEzaafE07KsGTG3rIVt5whFusCkKDE43W bGvRoM8gb8VhjGJxG/HGPH7CsvPE X-Google-Smtp-Source: AAOMgpc9ZnK5zDe8stA4rcRaONaFeTvcNx940jp444NZalYMnRX//3fWnej9LIlztc+Y2pdzPt/SOg== X-Received: by 2002:a1c:ee5d:: with SMTP id m90-v6mr3569670wmh.113.1530339086453; Fri, 29 Jun 2018 23:11:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 30 Jun 2018 08:10:36 +0200 Message-Id: <20180630061040.6018-44-pbonzini@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180630061040.6018-1-pbonzini@redhat.com> References: <20180630061040.6018-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22c Subject: [Qemu-devel] [PULL 43/47] vl: Use the IEC binary prefix definitions 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?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 It eases code review, unit is explicit. Patch generated using: $ git grep -n '[<>][<>]=3D ?[1-5]0' and modified manually. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180625124238.25339-44-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- vl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index ef6cfce..93795c1 100644 --- a/vl.c +++ b/vl.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-version.h" #include "qemu/cutils.h" @@ -2808,8 +2809,8 @@ static void set_memory_options(uint64_t *ram_slots, r= am_addr_t *maxram_size, if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) { uint64_t overflow_check =3D sz; =20 - sz <<=3D 20; - if ((sz >> 20) !=3D overflow_check) { + sz *=3D MiB; + if (sz / MiB !=3D overflow_check) { error_report("too large 'size' option value"); exit(EXIT_FAILURE); } --=20 1.8.3.1