Received: from eggs.gnu.org ([2001:4830:134:3::10]:55208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXQrs-0002ny-Gy for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:45:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXQrr-0008Of-Jj for qemu-devel@nongnu.org; Mon, 25 Jun 2018 08:45:16 -0400 Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Mon, 25 Jun 2018 09:42:35 -0300 Message-Id: <20180625124238.25339-44-f4bug@amsat.org> In-Reply-To: <20180625124238.25339-1-f4bug@amsat.org> References: <20180625124238.25339-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v5 43/46] vl: Use the IEC binary prefix definitions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , Stefan Weil , Eric Blake Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, qemu-trivial@nongnu.org, Paolo Bonzini It eases code review, unit is explicit. Patch generated using: $ git grep -n '[<>][<>]= ?[1-5]0' and modified manually. Suggested-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé --- vl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index d451f45dc5..7729ba390f 100644 --- a/vl.c +++ b/vl.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "qemu-version.h" #include "qemu/cutils.h" @@ -2790,7 +2791,7 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) { uint64_t overflow_check = sz; - sz <<= 20; + sz *= MiB; if ((sz >> 20) != overflow_check) { error_report("too large 'size' option value"); exit(EXIT_FAILURE); -- 2.18.0