From d899d2e248b900c53dd9081bde9f110e05747433 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Thu, 4 Dec 2014 07:28:34 +0800 Subject: vmdk: Set errp on failures in vmdk_open_vmdk4 Reported-by: Markus Armbruster Signed-off-by: Fam Zheng Reviewed-by: Markus Armbruster Reviewed-by: Don Koch Reviewed-by: Max Reitz Message-id: 1417649314-13704-7-git-send-email-famz@redhat.com Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- block/vmdk.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block') diff --git a/block/vmdk.c b/block/vmdk.c index da2d323..65af414 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -645,6 +645,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, bs->file->total_sectors * 512 - 1536, &footer, sizeof(footer)); if (ret < 0) { + error_setg_errno(errp, -ret, "Failed to read footer"); return ret; } @@ -656,6 +657,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, le32_to_cpu(footer.eos_marker.size) != 0 || le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM) { + error_setg(errp, "Invalid footer"); return -EINVAL; } @@ -686,6 +688,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gt) * le64_to_cpu(header.granularity); if (l1_entry_sectors == 0) { + error_setg(errp, "L1 entry size is invalid"); return -EINVAL; } l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1) -- cgit v1.1