From: Swapnil Ingle Date: Fri, 7 Aug 2020 10:03:23 +0000 (+0000) Subject: block/vhdx: Support vhdx image only with 512 bytes logical sector size X-Git-Tag: v5.2.0-rc0~114^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83a6a90009401f02bdb18fd2414dbae090d0f2b5;p=thirdparty%2Fqemu.git block/vhdx: Support vhdx image only with 512 bytes logical sector size block/vhdx uses qemu block layer where sector size is always 512 bytes. This may have issues with 4K logical sector sized vhdx image. For e.g qemu-img convert on such images fails with following assert: $qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <= qiov->size' failed. Aborted This patch adds an check to return ENOTSUP for vhdx images which have logical sector size other than 512 bytes. Signed-off-by: Swapnil Ingle Message-Id: <1596794594-44531-1-git-send-email-swapnil.ingle@nutanix.com> Signed-off-by: Max Reitz --- diff --git a/block/vhdx.c b/block/vhdx.c index 791eb90263c..356ec4c455a 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) goto exit; } - /* only 2 supported sector sizes */ - if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) { - ret = -EINVAL; + /* Currently we only support 512 */ + if (s->logical_sector_size != 512) { + ret = -ENOTSUP; goto exit; }