aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.c
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2017-06-20 16:01:36 +0300
committerKevin Wolf <kwolf@redhat.com>2017-06-26 14:51:13 +0200
commit24990c5b959c3a24d76ccf96303c1f70556f1dd2 (patch)
tree70e5a8a385159b0e0c82967222c2b22a44ae22d7 /block/qcow2.c
parentee22a9d86921310672aa8775489217f3e2f5e1c6 (diff)
downloadqemu-24990c5b959c3a24d76ccf96303c1f70556f1dd2.zip
qemu-24990c5b959c3a24d76ccf96303c1f70556f1dd2.tar.gz
qemu-24990c5b959c3a24d76ccf96303c1f70556f1dd2.tar.bz2
qcow2: Use offset_into_cluster() and offset_to_l2_index()
We already have functions for doing these calculations, so let's use them instead of doing everything by hand. This makes the code a bit more readable. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r--block/qcow2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 328b1d4..088ffe1 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -356,7 +356,7 @@ static int validate_table_offset(BlockDriverState *bs, uint64_t offset,
}
/* Tables must be cluster aligned */
- if (offset & (s->cluster_size - 1)) {
+ if (offset_into_cluster(s, offset) != 0) {
return -EINVAL;
}