qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-stable@nongnu.org, armbru@redhat.com,
	stefanha@redhat.com, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 2/3] qcow2.py: Add required padding for header extensions
Date: Tue, 25 Nov 2014 18:12:41 +0100	[thread overview]
Message-ID: <1416935562-7760-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1416935562-7760-1-git-send-email-kwolf@redhat.com>

The qcow2 specification requires that the header extension data be
padded to round up the extension size to the next multiple of 8 bytes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/qcow2.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py
index 2058596..9cc4cf7 100755
--- a/tests/qemu-iotests/qcow2.py
+++ b/tests/qemu-iotests/qcow2.py
@@ -7,6 +7,10 @@ import string
 class QcowHeaderExtension:
 
     def __init__(self, magic, length, data):
+        if length % 8 != 0:
+            padding = 8 - (length % 8)
+            data += "\0" * padding
+
         self.magic  = magic
         self.length = length
         self.data   = data
-- 
1.8.3.1

  parent reply	other threads:[~2014-11-25 17:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 17:12 [Qemu-devel] [PATCH v2 0/3] block: Don't probe for unknown backing file format Kevin Wolf
2014-11-25 17:12 ` [Qemu-devel] [PATCH v2 1/3] qcow2: Fix header extension size check Kevin Wolf
2014-11-25 17:22   ` Max Reitz
2014-11-25 17:12 ` Kevin Wolf [this message]
2014-11-25 17:23   ` [Qemu-devel] [PATCH v2 2/3] qcow2.py: Add required padding for header extensions Max Reitz
2014-11-25 17:12 ` [Qemu-devel] [PATCH v2 3/3] block: Don't probe for unknown backing file format Kevin Wolf
2014-11-25 17:24   ` Max Reitz
2014-11-28 11:33 ` [Qemu-devel] [PATCH v2 0/3] " Stefan Hajnoczi
2014-12-02 10:23   ` Kevin Wolf

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=1416935562-7760-3-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).