]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: Ignore reserved bits in refcount table entries
authorKevin Wolf <kwolf@redhat.com>
Fri, 16 Mar 2012 13:09:08 +0000 (14:09 +0100)
committerKevin Wolf <kwolf@redhat.com>
Fri, 20 Apr 2012 13:57:29 +0000 (15:57 +0200)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-refcount.c
block/qcow2.h

index 909d61560acc6659b1f68c383bbe2ee6029d7c35..e0854dc85d602b130531517db9371cb09dc1c1c4 100644 (file)
@@ -167,7 +167,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
     if (refcount_table_index < s->refcount_table_size) {
 
         uint64_t refcount_block_offset =
-            s->refcount_table[refcount_table_index];
+            s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK;
 
         /* If it's already there, we're done */
         if (refcount_block_offset) {
index a22d7fafbe894c484831c723691e0732c9f20ec5..291309a9e70ff74398236dab076939d5f2fa0907 100644 (file)
@@ -175,6 +175,8 @@ enum {
 #define L2E_OFFSET_MASK 0x00ffffffffffff00ULL
 #define L2E_COMPRESSED_OFFSET_SIZE_MASK 0x3fffffffffffffffULL
 
+#define REFT_OFFSET_MASK 0xffffffffffffff00ULL
+
 static inline int size_to_clusters(BDRVQcowState *s, int64_t size)
 {
     return (size + (s->cluster_size - 1)) >> s->cluster_bits;