qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH 03/17] block: Switch BlockRequest t


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 03/17] block: Switch BlockRequest to byte-based
Date: Thu, 14 Jul 2016 13:15:32 +0100
User-agent: Mutt/1.6.1 (2016-04-27)

On Wed, Jun 22, 2016 at 09:51:00AM -0600, Eric Blake wrote:
> @@ -2204,14 +2203,15 @@ BlockAIOCB *bdrv_aio_discard(BlockDriverState *bs,
>  {
>      Coroutine *co;
>      BlockAIOCBCoroutine *acb;
> +    QEMUIOVector qiov = { .size = nb_sectors << BDRV_SECTOR_BITS, };
> 
>      trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque);
> 
>      acb = qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque);
>      acb->need_bh = true;
>      acb->req.error = -EINPROGRESS;
> -    acb->req.sector = sector_num;
> -    acb->req.nb_sectors = nb_sectors;
> +    acb->req.offset = sector_num << BDRV_SECTOR_BITS;
> +    acb->req.qiov = &qiov;

This looks unsafe: the pointer to a stack-allocated qiov is held after
the function returns.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]