aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2009-09-15 12:30:43 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:52 -0500
commit80ee15a6b274dfcedb0ad7db8c9e7d392210d6a1 (patch)
tree4e20de957cf3d4709dd95082c96b9b1a7f8e3807 /qemu-img.c
parent85352471ce78d73b8306822959caace2e8880535 (diff)
downloadqemu-80ee15a6b274dfcedb0ad7db8c9e7d392210d6a1.zip
qemu-80ee15a6b274dfcedb0ad7db8c9e7d392210d6a1.tar.gz
qemu-80ee15a6b274dfcedb0ad7db8c9e7d392210d6a1.tar.bz2
qcow2: Increase maximum cluster size to 2 MB
This patch increases the maximum qcow2 cluster size to 2 MB. Starting with 128k clusters, L2 tables span 2 GB or more of virtual disk space, causing 32 bit truncation and wraparound of signed integers. Therefore some variables need to use a larger data type. While being at reviewing data types, change some integers that are used for array indices to unsigned. In some places they were checked against some upper limit but not for negative values. This could avoid potential segfaults with corrupted qcow2 images. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 070fe2e..204f618 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -530,7 +530,7 @@ static int is_allocated_sectors(const uint8_t *buf, int n, int *pnum)
return v;
}
-#define IO_BUF_SIZE 65536
+#define IO_BUF_SIZE (2 * 1024 * 1024)
static int img_convert(int argc, char **argv)
{