diff mbox series

crypto: initialize sector size even when opening with no IO flag

Message ID 20181016103105.30927-1-berrange@redhat.com
State New
Headers show
Series crypto: initialize sector size even when opening with no IO flag | expand

Commit Message

Daniel P. Berrangé Oct. 16, 2018, 10:31 a.m. UTC
The qcow2 block driver expects to see a valid sector size even when it
has opened the crypto layer with QCRYPTO_BLOCK_OPEN_NO_IO.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 crypto/block-qcow.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alberto Garcia Oct. 16, 2018, 10:59 a.m. UTC | #1
On Tue 16 Oct 2018 12:31:05 PM CEST, Daniel P. Berrangé wrote:
> The qcow2 block driver expects to see a valid sector size even when it
> has opened the crypto layer with QCRYPTO_BLOCK_OPEN_NO_IO.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

I was actually preparing a patch along these lines :-)

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto
Kevin Wolf Oct. 16, 2018, 11:35 a.m. UTC | #2
Am 16.10.2018 um 12:31 hat Daniel P. Berrangé geschrieben:
> The qcow2 block driver expects to see a valid sector size even when it
> has opened the crypto layer with QCRYPTO_BLOCK_OPEN_NO_IO.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Thanks, applied to the block branch (and staged before the other patch
that exposed the bug).

Kevin
diff mbox series

Patch

diff --git a/crypto/block-qcow.c b/crypto/block-qcow.c
index 4284e05167..7606231e79 100644
--- a/crypto/block-qcow.c
+++ b/crypto/block-qcow.c
@@ -102,6 +102,8 @@  qcrypto_block_qcow_open(QCryptoBlock *block,
                         Error **errp)
 {
     if (flags & QCRYPTO_BLOCK_OPEN_NO_IO) {
+        block->sector_size = QCRYPTO_BLOCK_QCOW_SECTOR_SIZE;
+        block->payload_offset = 0;
         return 0;
     } else {
         if (!options->u.qcow.key_secret) {