[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH 1/1] qemu-img: Cannot create fixed vhdx image

From: Michael Tokarev
Subject: Re: [Qemu-trivial] [PATCH 1/1] qemu-img: Cannot create fixed vhdx image
Date: Sat, 20 Sep 2014 17:53:32 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.7.0

18.09.2014 19:17, Adelina Tuvenie wrote:
> When trying to create a fixed vhd image qemu-img will return the
> following error:
> qemu-img: test.vhdx: Could not create image: Cannot allocate memory
> This happens because of a incorrect check in vhdx.c. Specifficaly,
> in vhdx_create_bat(), after allocating memory for the BAT entry,
> there is a check to determine if the allocation was unsuccsessful.
> The error comes from the fact that it checks if s->bat isn't NULL,
> which is true in case of succsessful allocation,  and exits with
> error ENOMEM.

Applying to -trivial, as it is an obvious trivial one-liner, hopefully
it's okay for kwolf@ and address@hidden  But please,

 - Cc qemu-devel and the subsystem maintainers (Cc'ed)
 - do not send an "intro" email for single patches
 - do not attach the patch, place it inline if possible

(Since the original patch was in an attachment, I copy it here for

diff --git a/block/vhdx.c b/block/vhdx.c
index 796b7bd..5bf292e 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1593,7 +1593,7 @@ static int vhdx_create_bat(BlockDriverState *bs, 
                 bdrv_has_zero_init(bs) == 0) {
         /* for a fixed file, the default BAT entry is not zero */
         s->bat = g_try_malloc0(length);
-        if (length && s->bat != NULL) {
+        if (length && s->bat == NULL) {
             ret = -ENOMEM;
             goto exit;

I also modified the subject line, to read:

  block: allow creation of fixed vhdx images



reply via email to

[Prev in Thread] Current Thread [Next in Thread]