qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] qemu-io: Respect early image end for map


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-io: Respect early image end for map
Date: Sat, 11 Oct 2014 11:53:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

Am 10.10.2014 um 14:03 schrieb Benoît Canet:
+        } else if (!num) {
+            error_report("Unexpected end of image");
+            return 0;
I think this test can miss some case of Unexpected end of image.

For example supose that in map_is_allocated the first bdrv_is_allocated
actually succeed then *pnum = num. Then the bottom loop has exit on failure
and the function return.

in map_f &num is map_is_allocated *pnum so map_f's num != 0 and this very test
fails to see the unexpected end of image error.

num != 0 because some sectors where successfully queried. In my opinion, we should print the information about them we have. Then, the do-while loop is repeated; and this time, map_is_allocated() either again returns num > 0 (for whatever reason, but I'd be fine with it) or, more probably, it'll be num == 0 this time. So the error is not missed, it's just printed one iteration later.

Max

Best regards

Benoît

          }
retstr = ret ? " allocated" : "not allocated";
--
2.0.4






reply via email to

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