[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH v3 07/13] qemu-img: Check create_opts before image
From: |
Max Reitz |
Subject: |
[Qemu-stable] [PATCH v3 07/13] qemu-img: Check create_opts before image amendment |
Date: |
Tue, 2 Dec 2014 18:32:47 +0100 |
The image options which can be amended are described by the .create_opts
field for every driver. This field must therefore be non-NULL so that
anything can be amended in the first place. Check that this holds true
before going into qemu_opts_create() (because if .create_opts is NULL,
the create_opts pointer in img_amend() will be NULL after
qemu_opts_append()).
Cc: address@hidden
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/qemu-img.c b/qemu-img.c
index 8c4edf3..7876258 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2986,6 +2986,13 @@ static int img_amend(int argc, char **argv)
goto out;
}
+ if (!bs->drv->create_opts) {
+ error_report("Format driver '%s' does not support any options to
amend",
+ fmt);
+ ret = -1;
+ goto out;
+ }
+
create_opts = qemu_opts_append(create_opts, bs->drv->create_opts);
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
if (options && qemu_opts_do_parse(opts, options, NULL)) {
--
1.9.3
- [Qemu-stable] [PATCH v3 00/13] block: Various Coverity-spotted fixes, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 03/13] block/vvfat: qcow driver may not be found, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 01/13] block: Make essential BlockDriver objects public, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 04/13] block/nfs: Add create_opts, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 02/13] block: Omit bdrv_find_format for essential drivers, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 06/13] qemu-img: Check create_opts before image creation, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 07/13] qemu-img: Check create_opts before image amendment,
Max Reitz <=
- [Qemu-stable] [PATCH v3 05/13] block: Check create_opts before image creation, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 09/13] iotests: Add test for unsupported image creation, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 08/13] iotests: Only kill NBD server if it runs, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 10/13] qcow2: Prevent numerical overflow, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 12/13] qcow2: Respect bdrv_truncate() error, Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 13/13] block/raw-posix: Fix ret in raw_open_common(), Max Reitz, 2014/12/02
- [Qemu-stable] [PATCH v3 11/13] qcow2: Flushing the caches in qcow2_close may fail, Max Reitz, 2014/12/02
- Re: [Qemu-stable] [PATCH v3 00/13] block: Various Coverity-spotted fixes, Kevin Wolf, 2014/12/03