]> git.proxmox.com Git - qemu.git/commitdiff
qcow2: fix unaligned access
authorAurelien Jarno <aurelien@aurel32.net>
Sat, 1 Jan 2011 20:50:34 +0000 (21:50 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 24 Jan 2011 10:08:50 +0000 (11:08 +0100)
cpu_to_be64w() is called with an obviously non-aligned pointer. Use
cpu_to_be64wu() instead. It fixes unaligned accesses errors on IA64
hosts.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-cluster.c

index 6928c6341d1498eb30da2b04ffe58962e42448ae..c3ef550f7e4a97d569d7bd6bfebde60fa963070c 100644 (file)
@@ -81,7 +81,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, int min_size, bool exact_size)
     /* set new table */
     BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE);
     cpu_to_be32w((uint32_t*)data, new_l1_size);
-    cpu_to_be64w((uint64_t*)(data + 4), new_l1_table_offset);
+    cpu_to_be64wu((uint64_t*)(data + 4), new_l1_table_offset);
     ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_size), data,sizeof(data));
     if (ret < 0) {
         goto fail;