From 93ceec25728497b5a4902b78b15a60b576d1e2a2 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Tue, 14 Feb 2012 11:14:36 +0100
Subject: [PATCH 71/99] qcow2: Properly initialise QcowL2Meta

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1329218101-24213-72-git-send-email-kwolf@redhat.com>
Patchwork-id: 37262
O-Subject: [RHEL-6.3 qemu-kvm PATCH v2 71/96] qcow2: Properly initialise QcowL2Meta
Bugzilla: 783950
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

Bugzilla: 783950

Dependency list pointers filled with random garbage from the stack aren't a
good idea.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 8e217d5384a38bdb4727c4e22d7ed64c351361f7)
---
 block/qcow2.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 block/qcow2.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 97fed99..7fc2a32 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -524,13 +524,14 @@ static int qcow2_co_writev(BlockDriverState *bs,
     int n_end;
     int ret;
     int cur_nr_sectors; /* number of sectors in current iteration */
-    QCowL2Meta l2meta;
     uint64_t cluster_offset;
     QEMUIOVector hd_qiov;
     uint64_t bytes_done = 0;
     uint8_t *cluster_data = NULL;
+    QCowL2Meta l2meta = {
+        .nb_clusters = 0,
+    };
 
-    l2meta.nb_clusters = 0;
     qemu_co_queue_init(&l2meta.dependent_requests);
 
     qemu_iovec_init(&hd_qiov, qiov->niov);
-- 
1.7.7.5