[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 044/100] qcow: require image size to be > 1 for new i
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 044/100] qcow: require image size to be > 1 for new images |
Date: |
Fri, 7 Jul 2017 19:07:59 +0200 |
From: "Daniel P. Berrange" <address@hidden>
The qcow driver refuses to open images which are less than
2 bytes in size, but will happily create such images. Add
a check in the create path to avoid this discrepancy.
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/block/qcow.c b/block/qcow.c
index 7bd94dc..49871fb 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -811,6 +811,12 @@ static int qcow_create(const char *filename, QemuOpts
*opts, Error **errp)
/* Read out options */
total_size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
BDRV_SECTOR_SIZE);
+ if (total_size == 0) {
+ error_setg(errp, "Image size is too small, cannot be zero length");
+ ret = -EINVAL;
+ goto cleanup;
+ }
+
backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) {
flags |= BLOCK_FLAG_ENCRYPT;
--
1.8.3.1
- [Qemu-block] [PULL 031/100] mirror: Switch mirror_do_read() to byte-based, (continued)
- [Qemu-block] [PULL 031/100] mirror: Switch mirror_do_read() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 032/100] mirror: Switch mirror_iteration() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 033/100] block: Drop unused bdrv_round_sectors_to_clusters(), Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 034/100] backup: Switch BackupBlockJob to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 037/100] backup: Switch backup_run() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 035/100] backup: Switch block_backup.h to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 036/100] backup: Switch backup_do_cow() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 039/100] block: Minimize raw use of bds->total_sectors, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 040/100] block: Make bdrv_is_allocated_above() byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 038/100] block: Make bdrv_is_allocated() byte-based, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 044/100] qcow: require image size to be > 1 for new images,
Kevin Wolf <=
- [Qemu-block] [PULL 042/100] block: add ability to set a prefix for opt names, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 043/100] qcow: document another weakness of qcow AES encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 046/100] iotests: skip 048 with qcow which doesn't support resize, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 041/100] block: expose crypto option names / defs to other drivers, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 045/100] iotests: skip 042 with qcow which dosn't support zero sized images, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 049/100] qcow: convert QCow to use QCryptoBlock for encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 047/100] block: deprecate "encryption=on" in favor of "encrypt.format=aes", Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 052/100] qcow2: extend specification to cover LUKS encryption, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 050/100] qcow2: make qcow2_encrypt_sectors encrypt in place, Kevin Wolf, 2017/07/07
- [Qemu-block] [PULL 055/100] iotests: enable tests 134 and 158 to work with qcow (v1), Kevin Wolf, 2017/07/07