summary refs log tree commit diff
path: root/qcow
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2018-03-07 16:35:46 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-07 22:08:20 -0800
commit818afd6eb058b96755a2d1fc1da9def06bfa90c6 (patch)
treeb63b0944cd09e3784bd2065167882d9aa593e9f7 /qcow
parentd1ab49367236397bcbb3fc7b5bc0077c6a761273 (diff)
downloadcrosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar.gz
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar.bz2
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar.lz
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar.xz
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.tar.zst
crosvm-818afd6eb058b96755a2d1fc1da9def06bfa90c6.zip
qcow: Fix refcount_bytes
This should be the number of bits (1 << order) divided by bits per byte.

BUG=none
TEST=cargo test

Change-Id: I201dbaf21d13a82af6bcb493ba5f3b62c89286fa
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/954348
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'qcow')
-rw-r--r--qcow/src/qcow.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/qcow/src/qcow.rs b/qcow/src/qcow.rs
index df504de..0567c68 100644
--- a/qcow/src/qcow.rs
+++ b/qcow/src/qcow.rs
@@ -143,7 +143,7 @@ impl QcowHeader {
                 // Pre-allocate enough clusters for the entire refcount table as it must be
                 // continuous in the file. Allocate enough space to refcount all clusters, including
                 // the refcount clusters.
-                let refcount_bytes = 0x01u32 << DEFAULT_REFCOUNT_ORDER / 8;
+                let refcount_bytes = (0x01u32 << DEFAULT_REFCOUNT_ORDER) / 8;
                 let for_data = div_round_up_u32(num_clusters * refcount_bytes, cluster_size);
                 let for_refcounts = div_round_up_u32(for_data * refcount_bytes, cluster_size);
                 let max_refcount_clusters = for_data + for_refcounts;