928071
From e8ec08a62a3ffce3deeeecd8e68408d0879f6915 Mon Sep 17 00:00:00 2001
928071
From: Peter Maydell <peter.maydell@linaro.org>
928071
Date: Fri, 28 Mar 2014 14:22:49 +0000
928071
Subject: [PATCH] dma-helpers: Initialize DMAAIOCB in_cancel flag
928071
MIME-Version: 1.0
928071
Content-Type: text/plain; charset=UTF-8
928071
Content-Transfer-Encoding: 8bit
928071
928071
RH-Author: Stefano Garzarella <sgarzare@redhat.com>
928071
RH-MergeRequest: 53: dma-helpers: Initialize DMAAIOCB in_cancel flag
928071
RH-Commit: [1/1] a729d40a4eae4ff0262764d9003552d1e4d67976
928071
RH-Bugzilla: 2007036
928071
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
928071
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
928071
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
928071
928071
Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
928071
does not return zero-initialized memory. Spotted by the clang sanitizer
928071
(which complained when the value loaded in dma_complete() was not valid
928071
for a bool type); this might have resulted in leaking the AIO block.
928071
928071
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
928071
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
928071
(cherry picked from commit 4d1cb6e6f51b0d8405f701806a203a73e7431fe5)
928071
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
928071
---
928071
 dma-helpers.c | 1 +
928071
 1 file changed, 1 insertion(+)
928071
928071
diff --git a/dma-helpers.c b/dma-helpers.c
928071
index 272632f367..7335dd71c7 100644
928071
--- a/dma-helpers.c
928071
+++ b/dma-helpers.c
928071
@@ -216,6 +216,7 @@ BlockDriverAIOCB *dma_bdrv_io(
928071
     dbs->sg_cur_index = 0;
928071
     dbs->sg_cur_byte = 0;
928071
     dbs->dir = dir;
928071
+    dbs->in_cancel = false;
928071
     dbs->io_func = io_func;
928071
     dbs->bh = NULL;
928071
     qemu_iovec_init(&dbs->iov, sg->nsg);
928071
-- 
928071
2.27.0
928071