thebeanogamer / rpms / qemu-kvm

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