Blob Blame Raw
From e02cdc5fccb977bde5162af586a8cc4dcaf7c5f4 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Fri, 17 Jan 2014 03:07:46 +0100
Subject: [PATCH 03/34] vvfat: use bdrv_new() to allocate BlockDriverState

RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <1389928083-8921-2-git-send-email-famz@redhat.com>
Patchwork-id: 56763
O-Subject: [RHEL-7 qemu-kvm PATCH 01/18] vvfat: use bdrv_new() to allocate BlockDriverState
Bugzilla: 1041301
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

we need bdrv_new() to properly initialize BDS, don't allocate memory
manually.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 3d34c6cd99f434126365150c2535bbf93b94f891)
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/vvfat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/vvfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/vvfat.c b/block/vvfat.c
index cb45687..2c7970d 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2951,7 +2951,7 @@ static int enable_write_target(BDRVVVFATState *s)
     unlink(s->qcow_filename);
 #endif
 
-    s->bs->backing_hd = calloc(sizeof(BlockDriverState), 1);
+    s->bs->backing_hd = bdrv_new("");
     s->bs->backing_hd->drv = &vvfat_write_target;
     s->bs->backing_hd->opaque = g_malloc(sizeof(void*));
     *(void**)s->bs->backing_hd->opaque = s;
-- 
1.7.1