qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag
@ 2014-03-28 14:22 Peter Maydell
  2014-03-28 14:24 ` Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Peter Maydell @ 2014-03-28 14:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, patches

Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
does not return zero-initialized memory. Spotted by the clang sanitizer
(which complained when the value loaded in dma_complete() was not valid
for a bool type); this might have resulted in leaking the AIO block.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---

 dma-helpers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dma-helpers.c b/dma-helpers.c
index c9620a5..5f421e9 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -213,6 +213,7 @@ BlockDriverAIOCB *dma_bdrv_io(
     dbs->sg_cur_index = 0;
     dbs->sg_cur_byte = 0;
     dbs->dir = dir;
+    dbs->in_cancel = false;
     dbs->io_func = io_func;
     dbs->bh = NULL;
     qemu_iovec_init(&dbs->iov, sg->nsg);
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag
  2014-03-28 14:22 [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag Peter Maydell
@ 2014-03-28 14:24 ` Peter Maydell
  2014-04-03 14:28 ` Peter Maydell
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-03-28 14:24 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Kevin Wolf, Stefan Hajnoczi, Patch Tracking

On 28 March 2014 14:22, Peter Maydell <peter.maydell@linaro.org> wrote:
> Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
> does not return zero-initialized memory. Spotted by the clang sanitizer
> (which complained when the value loaded in dma_complete() was not valid
> for a bool type); this might have resulted in leaking the AIO block.

Please ignore the 1/2 in the header -- this is a single
standalone patch, I just fluffed the git-format-patch command.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag
  2014-03-28 14:22 [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag Peter Maydell
  2014-03-28 14:24 ` Peter Maydell
@ 2014-04-03 14:28 ` Peter Maydell
  2014-04-04  7:19 ` Stefan Hajnoczi
  2014-04-04 17:39 ` Kevin Wolf
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-04-03 14:28 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Kevin Wolf, Stefan Hajnoczi, Patch Tracking

On 28 March 2014 14:22, Peter Maydell <peter.maydell@linaro.org> wrote:
> Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
> does not return zero-initialized memory. Spotted by the clang sanitizer
> (which complained when the value loaded in dma_complete() was not valid
> for a bool type); this might have resulted in leaking the AIO block.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>
>  dma-helpers.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/dma-helpers.c b/dma-helpers.c
> index c9620a5..5f421e9 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -213,6 +213,7 @@ BlockDriverAIOCB *dma_bdrv_io(
>      dbs->sg_cur_index = 0;
>      dbs->sg_cur_byte = 0;
>      dbs->dir = dir;
> +    dbs->in_cancel = false;
>      dbs->io_func = io_func;
>      dbs->bh = NULL;
>      qemu_iovec_init(&dbs->iov, sg->nsg);
> --
> 1.9.0

Ping, or do we think this isn't worthwhile for 2.0?

(I guess I should have stuck a for-2.0 in the subject.)

thanks
-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag
  2014-03-28 14:22 [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag Peter Maydell
  2014-03-28 14:24 ` Peter Maydell
  2014-04-03 14:28 ` Peter Maydell
@ 2014-04-04  7:19 ` Stefan Hajnoczi
  2014-04-04 17:39 ` Kevin Wolf
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2014-04-04  7:19 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Kevin Wolf, qemu-devel, patches

On Fri, Mar 28, 2014 at 02:22:49PM +0000, Peter Maydell wrote:
> Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
> does not return zero-initialized memory. Spotted by the clang sanitizer
> (which complained when the value loaded in dma_complete() was not valid
> for a bool type); this might have resulted in leaking the AIO block.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> 
>  dma-helpers.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/dma-helpers.c b/dma-helpers.c
> index c9620a5..5f421e9 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -213,6 +213,7 @@ BlockDriverAIOCB *dma_bdrv_io(
>      dbs->sg_cur_index = 0;
>      dbs->sg_cur_byte = 0;
>      dbs->dir = dir;
> +    dbs->in_cancel = false;
>      dbs->io_func = io_func;
>      dbs->bh = NULL;
>      qemu_iovec_init(&dbs->iov, sg->nsg);

Worth merging for 2.0.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag
  2014-03-28 14:22 [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag Peter Maydell
                   ` (2 preceding siblings ...)
  2014-04-04  7:19 ` Stefan Hajnoczi
@ 2014-04-04 17:39 ` Kevin Wolf
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2014-04-04 17:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Stefan Hajnoczi, patches

Am 28.03.2014 um 15:22 hat Peter Maydell geschrieben:
> Initialize the dbs->in_cancel flag in dma_bdrv_io(), since qemu_aio_get()
> does not return zero-initialized memory. Spotted by the clang sanitizer
> (which complained when the value loaded in dma_complete() was not valid
> for a bool type); this might have resulted in leaking the AIO block.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-04 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28 14:22 [Qemu-devel] [PATCH 1/2] dma-helpers: Initialize DMAAIOCB in_cancel flag Peter Maydell
2014-03-28 14:24 ` Peter Maydell
2014-04-03 14:28 ` Peter Maydell
2014-04-04  7:19 ` Stefan Hajnoczi
2014-04-04 17:39 ` Kevin Wolf

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).