diff options
author | Dave Reisner | 2011-02-15 10:06:08 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-15 10:13:31 +0100 |
commit | f9e05dafd0fa36b2cb29eb30250dc63039a34bf2 (patch) | |
tree | 8292541ecb2c91f601517f2261960cdd918b164a /tests/expected/misc | |
parent | more: new usage output, and some trivial fixes (diff) | |
download | kernel-qcow2-util-linux-f9e05dafd0fa36b2cb29eb30250dc63039a34bf2.tar.gz kernel-qcow2-util-linux-f9e05dafd0fa36b2cb29eb30250dc63039a34bf2.tar.xz kernel-qcow2-util-linux-f9e05dafd0fa36b2cb29eb30250dc63039a34bf2.zip |
lib: [strutils] avoid integer overflow on large values
This is visible on a 2TB disk via lsblk, where a large partition
incorrectly displays as 1.171798692T instead of 1.8T. This is
corrected by using a uint64_t type instead of a simple int --
consistant with the type used in lsblk.c to represent the raw size in
bytes.
[kzak@redhat.com: - add EiB support
- add size_to_human_string() to regression tests]
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/expected/misc')
-rw-r--r-- | tests/expected/misc/strtosize | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/tests/expected/misc/strtosize b/tests/expected/misc/strtosize index d1c039d2d..0dd5e3e76 100644 --- a/tests/expected/misc/strtosize +++ b/tests/expected/misc/strtosize @@ -1,30 +1,30 @@ test_strutils: invalid size '-1' value - 0 : 0 - 1 : 1 - 123 : 123 - 18446744073709551615 : 18446744073709551615 - 1K : 1024 - 1KiB : 1024 - 1M : 1048576 - 1MiB : 1048576 - 1G : 1073741824 - 1GiB : 1073741824 - 1T : 1099511627776 - 1TiB : 1099511627776 - 1P : 1125899906842624 - 1PiB : 1125899906842624 - 1E : 1152921504606846976 - 1EiB : 1152921504606846976 - 1KB : 1000 - 1MB : 1000000 - 1GB : 1000000000 - 1TB : 1000000000000 - 1PB : 1000000000000000 - 1EB : 1000000000000000000 + 0 : 0 : 0B + 1 : 1 : 1B + 123 : 123 : 123B + 18446744073709551615 : 18446744073709551615 : 16E + 1K : 1024 : 1K + 1KiB : 1024 : 1K + 1M : 1048576 : 1M + 1MiB : 1048576 : 1M + 1G : 1073741824 : 1G + 1GiB : 1073741824 : 1G + 1T : 1099511627776 : 1T + 1TiB : 1099511627776 : 1T + 1P : 1125899906842624 : 1P + 1PiB : 1125899906842624 : 1P + 1E : 1152921504606846976 : 1E + 1EiB : 1152921504606846976 : 1E + 1KB : 1000 : 1000B + 1MB : 1000000 : 976.6K + 1GB : 1000000000 : 953.7M + 1TB : 1000000000000 : 931.3G + 1PB : 1000000000000000 : 909.5T + 1EB : 1000000000000000000 : 888.2P test_strutils: invalid size '' value test_strutils: invalid size ' ' value - 1 : 1 + 1 : 1 : 1B test_strutils: invalid size '1 ' value - 0x0a : 10 - 0xff00 : 65280 - 0x80000000 : 2147483648 + 0x0a : 10 : 10B + 0xff00 : 65280 : 63.8K + 0x80000000 : 2147483648 : 2G |