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>
This commit is contained in:
parent
9aeecbbc62
commit
d899d2e248
|
@ -645,6 +645,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||||
bs->file->total_sectors * 512 - 1536,
|
bs->file->total_sectors * 512 - 1536,
|
||||||
&footer, sizeof(footer));
|
&footer, sizeof(footer));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
error_setg_errno(errp, -ret, "Failed to read footer");
|
||||||
return ret;
|
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.size) != 0 ||
|
||||||
le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM)
|
le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM)
|
||||||
{
|
{
|
||||||
|
error_setg(errp, "Invalid footer");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,6 +688,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||||
l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gt)
|
l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gt)
|
||||||
* le64_to_cpu(header.granularity);
|
* le64_to_cpu(header.granularity);
|
||||||
if (l1_entry_sectors == 0) {
|
if (l1_entry_sectors == 0) {
|
||||||
|
error_setg(errp, "L1 entry size is invalid");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1)
|
l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1)
|
||||||
|
|
Loading…
Reference in New Issue