thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 005308f5b469f749980310be141315e8bd46556f Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Mon, 15 Feb 2016 09:28:20 +0100
9ae3a8
Subject: [PATCH 07/18] vmdk: Set errp on failures in vmdk_open_vmdk4
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1455528511-9357-8-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 69173
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH 07/18] vmdk: Set errp on failures in vmdk_open_vmdk4
9ae3a8
Bugzilla: 1299250
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1299250
9ae3a8
9ae3a8
Reported-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Reviewed-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Reviewed-by: Don Koch <dkoch@verizon.com>
9ae3a8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: 1417649314-13704-7-git-send-email-famz@redhat.com
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit d899d2e248b900c53dd9081bde9f110e05747433)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c | 3 +++
9ae3a8
 1 file changed, 3 insertions(+)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 69d8a6e..1247ea4 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -647,6 +647,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
9ae3a8
             bs->file->total_sectors * 512 - 1536,
9ae3a8
             &footer, sizeof(footer));
9ae3a8
         if (ret < 0) {
9ae3a8
+            error_setg_errno(errp, -ret, "Failed to read footer");
9ae3a8
             return ret;
9ae3a8
         }
9ae3a8
 
9ae3a8
@@ -658,6 +659,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
9ae3a8
             le32_to_cpu(footer.eos_marker.size) != 0  ||
9ae3a8
             le32_to_cpu(footer.eos_marker.type) != MARKER_END_OF_STREAM)
9ae3a8
         {
9ae3a8
+            error_setg(errp, "Invalid footer");
9ae3a8
             return -EINVAL;
9ae3a8
         }
9ae3a8
 
9ae3a8
@@ -688,6 +690,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
9ae3a8
     l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gt)
9ae3a8
                         * le64_to_cpu(header.granularity);
9ae3a8
     if (l1_entry_sectors == 0) {
9ae3a8
+        error_setg(errp, "L1 entry size is invalid");
9ae3a8
         return -EINVAL;
9ae3a8
     }
9ae3a8
     l1_size = (le64_to_cpu(header.capacity) + l1_entry_sectors - 1)
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8