From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNfpc-0004rs-Sh for qemu-devel@nongnu.org; Thu, 14 Jul 2016 08:33:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNfpb-0003WI-52 for qemu-devel@nongnu.org; Thu, 14 Jul 2016 08:33:32 -0400 References: <1466610674-23157-1-git-send-email-eblake@redhat.com> <1466610674-23157-4-git-send-email-eblake@redhat.com> <20160714121532.GF15476@stefanha-x1.localdomain> From: Eric Blake Message-ID: <57878692.8020101@redhat.com> Date: Thu, 14 Jul 2016 06:33:22 -0600 MIME-Version: 1.0 In-Reply-To: <20160714121532.GF15476@stefanha-x1.localdomain> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GaHwc0CNLNHh4PPGxBFeesXh7x6wR3AcQ" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 03/17] block: Switch BlockRequest to byte-based List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, kwolf@redhat.com, Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GaHwc0CNLNHh4PPGxBFeesXh7x6wR3AcQ From: Eric Blake To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, kwolf@redhat.com, Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, Max Reitz Message-ID: <57878692.8020101@redhat.com> Subject: Re: [Qemu-block] [PATCH 03/17] block: Switch BlockRequest to byte-based References: <1466610674-23157-1-git-send-email-eblake@redhat.com> <1466610674-23157-4-git-send-email-eblake@redhat.com> <20160714121532.GF15476@stefanha-x1.localdomain> In-Reply-To: <20160714121532.GF15476@stefanha-x1.localdomain> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/14/2016 06:15 AM, Stefan Hajnoczi wrote: > 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 =3D { .size =3D nb_sectors << BDRV_SECTOR_BITS,= }; >> >> trace_bdrv_aio_discard(bs, sector_num, nb_sectors, opaque); >> >> acb =3D qemu_aio_get(&bdrv_em_co_aiocb_info, bs, cb, opaque); >> acb->need_bh =3D true; >> acb->req.error =3D -EINPROGRESS; >> - acb->req.sector =3D sector_num; >> - acb->req.nb_sectors =3D nb_sectors; >> + acb->req.offset =3D sector_num << BDRV_SECTOR_BITS; >> + acb->req.qiov =3D &qiov; >=20 > This looks unsafe: the pointer to a stack-allocated qiov is held after > the function returns. Hmm, you're right. I'll definitely have to rework this one. But since the ONLY thing being passed through the qiov was the size, it may be easiest to just add acb->req.size. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GaHwc0CNLNHh4PPGxBFeesXh7x6wR3AcQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXh4aSAAoJEKeha0olJ0NqBAMH/2AOS2JdyZQ8wNIzv4JnjAY8 ZOYgVidpqW8CvIzCvT8fTtWPdLTmX6MSkjSxX5Dqaeuw9ifG9MKvUa70uEBv+jWS TKRbyUGQZX63rJAF8JTy31flxywaqEEc2JrRJhE+QijWnr5fWSPOzI5GXZ3UGi1v 1u/EoKxKXDkCQ8aYWrass7fUwvQJapAbu/qW6aGZkcoVyvLOacqbstBaEr0SfDUh qTIWolisqFI6XiLeEaUSfh64KAI+Fh47G25rMwl3rcdBsgFhO3N6DyViRap/JnsX SZv0RS1J2sxNOLRMmf7L65zqiKETL5hJo2F9/DAYIK1D5XQfwZ5ZGYfKacrWoR0= =DW41 -----END PGP SIGNATURE----- --GaHwc0CNLNHh4PPGxBFeesXh7x6wR3AcQ--