[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/8] qcow2: Correct endianness in overlap check
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 1/8] qcow2: Correct endianness in overlap check |
Date: |
Mon, 7 Oct 2013 13:28:02 +0200 |
From: Max Reitz <address@hidden>
If an inactive L1 table is loaded from disk, its entries are in big
endian and have to be converted to host byte order before using them.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/qcow2-refcount.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index d2b7064..364eeba 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1733,8 +1733,8 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs,
int chk, int64_t offset,
}
for (j = 0; j < l1_sz; j++) {
- if ((l1[j] & L1E_OFFSET_MASK) &&
- overlaps_with(l1[j] & L1E_OFFSET_MASK, s->cluster_size)) {
+ uint64_t l2_ofs = be64_to_cpu(l1[j]) & L1E_OFFSET_MASK;
+ if (l2_ofs && overlaps_with(l2_ofs, s->cluster_size)) {
g_free(l1);
return QCOW2_OL_INACTIVE_L2;
}
--
1.8.3.1
- [Qemu-devel] [PULL 0/8] Block patches, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 1/8] qcow2: Correct endianness in overlap check,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 2/8] qcow2: CHECK_OFLAG_COPIED is obsolete, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 3/8] block: use correct filename for error report, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 4/8] block: vhdx - add migration blocker, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 6/8] qcow2: Free allocated L2 cluster on error, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 5/8] qcow2: Switch L1 table in a single sequence, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 7/8] qemu-iotests: Correct 026 output, Stefan Hajnoczi, 2013/10/07
- [Qemu-devel] [PULL 8/8] block: use correct filename, Stefan Hajnoczi, 2013/10/07