summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorEric Blake2019-04-17 19:11:00 +0200
committerKevin Wolf2019-04-30 15:29:00 +0200
commit754da86714d550c3f995f11a2587395081362e0a (patch)
treee344c4e59d35a4e5bb7ca411da77bc01fa2a20d3 /util
parentblock/vhdx: Use IEC binary prefixes for size constants (diff)
downloadqemu-754da86714d550c3f995f11a2587395081362e0a.tar.gz
qemu-754da86714d550c3f995f11a2587395081362e0a.tar.xz
qemu-754da86714d550c3f995f11a2587395081362e0a.zip
cutils: Fix size_to_str() on 32-bit platforms
When extracting a human-readable size formatter, we changed 'uint64_t div' pre-patch to 'unsigned long div' post-patch. Which breaks on 32-bit platforms, resulting in 'inf' instead of intended values larger than 999GB. Fixes: 22951aaa CC: qemu-stable@nongnu.org Reported-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/cutils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cutils.c b/util/cutils.c
index e098debdc0..d682c90901 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -825,7 +825,7 @@ const char *qemu_ether_ntoa(const MACAddr *mac)
char *size_to_str(uint64_t val)
{
static const char *suffixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" };
- unsigned long div;
+ uint64_t div;
int i;
/*