qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] vdi: Fix error message and two more small code improvements
@ 2014-03-26 21:38 Stefan Weil
  2014-03-26 21:38 ` [Qemu-devel] [PATCH 2/2] vdi: add bounds checks for block related header fields (CVE-2014-0144) Stefan Weil
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Weil @ 2014-03-26 21:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Weil, Stefan Hajnoczi

* Fix wrong error message (copy+paste bug from commit
  5b7aa9b56d1bfc79916262f380c3fc7961becb50).

* Replace the default cluster size of 1 * MiB by DEFAULT_CLUSTER_SIZE.

* Don't check for the default cluster size if we support other sizes, too.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 block/vdi.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/block/vdi.c b/block/vdi.c
index ac9a025..b832905 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -420,11 +420,13 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
                    header.sector_size, SECTOR_SIZE);
         ret = -ENOTSUP;
         goto fail;
-    } else if (header.block_size != 1 * MiB) {
-        error_setg(errp, "unsupported VDI image (sector size %u is not %u)",
-                   header.block_size, 1 * MiB);
+#if !defined(CONFIG_VDI_BLOCK_SIZE)
+    } else if (header.block_size != DEFAULT_CLUSTER_SIZE) {
+        error_setg(errp, "unsupported VDI image (block size %u is not %u)",
+                   header.block_size, DEFAULT_CLUSTER_SIZE);
         ret = -ENOTSUP;
         goto fail;
+#endif
     } else if (header.disk_size >
                (uint64_t)header.blocks_in_image * header.block_size) {
         error_setg(errp, "unsupported VDI image (disk size %" PRIu64 ", "
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-28  8:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 21:38 [Qemu-devel] [PATCH 1/2] vdi: Fix error message and two more small code improvements Stefan Weil
2014-03-26 21:38 ` [Qemu-devel] [PATCH 2/2] vdi: add bounds checks for block related header fields (CVE-2014-0144) Stefan Weil
2014-03-27 19:49   ` Jeff Cody
2014-03-27 20:25     ` Stefan Weil
2014-03-28  8:47       ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).