]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2-refcount.c
qcow2: Use pread for inactive L1 in overlap check
authorMax Reitz <mreitz@redhat.com>
Wed, 9 Oct 2013 08:42:56 +0000 (10:42 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 11 Oct 2013 14:49:59 +0000 (16:49 +0200)
commit998b959c1e59044f5d5f64c482f4ce8facc8e0bc
tree54aeeb7fcc771e456e6bdd761991122f76e65869
parentf252080453ec081ba653bba4e0c1ca86c52cf19f
qcow2: Use pread for inactive L1 in overlap check

Currently, qcow2_check_metadata_overlap uses bdrv_read to read inactive
L1 tables from disk. The number of sectors to read is calculated through
a truncating integer division, therefore, if the L1 table size is not a
multiple of the sector size, the final entries will not be read and
their entries in memory remain undefined (from the g_malloc).
Using bdrv_pread fixes this.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-refcount.c