All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH for-2.3 v2 6/6] vmdk: Set errp on failures in vmdk_open_vmdk4
Date: Wed,  3 Dec 2014 10:05:14 +0800	[thread overview]
Message-ID: <1417572314-5504-7-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1417572314-5504-1-git-send-email-famz@redhat.com>

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 block/vmdk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index cde1870..6df0472 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -642,6 +642,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;
         }
 
@@ -653,6 +654,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;
         }
 
@@ -683,6 +685,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)
-- 
1.9.3

      parent reply	other threads:[~2014-12-03  2:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  2:05 [Qemu-devel] [PATCH for-2.3 v2 0/6] vmdk: A few small fixes Fam Zheng
2014-12-03  2:05 ` [Qemu-devel] [PATCH for-2.3 v2 1/6] vmdk: Use g_random_int to generate CID Fam Zheng
2014-12-03  2:05 ` [Qemu-devel] [PATCH for-2.3 v2 2/6] vmdk: Fix comment to match code of extent lines Fam Zheng
2014-12-03  2:05 ` [Qemu-devel] [PATCH for-2.3 v2 3/6] vmdk: Clean up descriptor file reading Fam Zheng
2014-12-03  8:21   ` Markus Armbruster
2014-12-03  9:20     ` Fam Zheng
2014-12-03 16:43       ` Don Koch
2014-12-03  2:05 ` [Qemu-devel] [PATCH for-2.3 v2 4/6] vmdk: Check descriptor file length when reading it Fam Zheng
2014-12-03  2:05 ` [Qemu-devel] [PATCH for-2.3 v2 5/6] vmdk: Remove unnecessary initialization Fam Zheng
2014-12-03  2:05 ` Fam Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417572314-5504-7-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.