]> Git Repo - qemu.git/commitdiff
cutils: Fix size_to_str() on 32-bit platforms
authorEric Blake <[email protected]>
Wed, 17 Apr 2019 17:11:00 +0000 (12:11 -0500)
committerKevin Wolf <[email protected]>
Tue, 30 Apr 2019 13:29:00 +0000 (15:29 +0200)
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: [email protected]
Reported-by: Max Reitz <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
util/cutils.c

index e098debdc0cdf34106116068f6ceff181805d2d7..d682c909015725c83f79e1dae0c678b4ac9cb028 100644 (file)
@@ -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;
 
     /*
This page took 0.026273 seconds and 4 git commands to generate.