aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-12-04 07:28:34 +0800
committerKevin Wolf <kwolf@redhat.com>2014-12-10 10:31:21 +0100
commitd899d2e248b900c53dd9081bde9f110e05747433 (patch)
treebd9097c6e6f2214a70e4365c639222e3404eefde /block
parent9aeecbbc62ce52a94b2621a0d53567b5d4ed915d (diff)
downloadqemu-d899d2e248b900c53dd9081bde9f110e05747433.zip
qemu-d899d2e248b900c53dd9081bde9f110e05747433.tar.gz
qemu-d899d2e248b900c53dd9081bde9f110e05747433.tar.bz2
vmdk: Set errp on failures in vmdk_open_vmdk4
Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Don Koch <dkoch@verizon.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1417649314-13704-7-git-send-email-famz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c3
1 files changed, 3 insertions, 0 deletions
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)