From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUZ5r-0000y4-Qr for qemu-devel@nongnu.org; Mon, 10 Jul 2017 09:51:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUZ5q-0004b4-PU for qemu-devel@nongnu.org; Mon, 10 Jul 2017 09:51:19 -0400 References: <20170710083553.6167-1-den@openvz.org> From: Eric Blake Message-ID: Date: Mon, 10 Jul 2017 08:51:02 -0500 MIME-Version: 1.0 In-Reply-To: <20170710083553.6167-1-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IfAIVQvxPiBbsGacNVOkJFvS1NsjqnqIW" Subject: Re: [Qemu-devel] [PATCH 1/1] block: fix possible return code clobbering in bdrv_co_pdiscard List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, qemu-stable This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IfAIVQvxPiBbsGacNVOkJFvS1NsjqnqIW From: Eric Blake To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, qemu-stable Message-ID: Subject: Re: [Qemu-devel] [PATCH 1/1] block: fix possible return code clobbering in bdrv_co_pdiscard References: <20170710083553.6167-1-den@openvz.org> In-Reply-To: <20170710083553.6167-1-den@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/10/2017 03:35 AM, Denis V. Lunev wrote: > Signed-off-by: Denis V. Lunev > CC: Stefan Hajnoczi (supporter:Block I/O path) > CC: Fam Zheng (supporter:Block I/O path) The commit message is a bit sparse; I might have written: block: fix shadowed variable in bdrv_co_pdiscard We've had a shadowed 'ret' variable, which risks returning the wrong value, introduced in commit b9c64947. > --- > block/io.c | 1 - > 1 file changed, 1 deletion(-) Adding qemu-stable in cc, and you can add: Reviewed-by: Eric Blake [and I wonder why gcc doesn't flag the shadowed variable for me - I definitely touched that code in commit 9f1963b3, but didn't notice that I kept the shadowing in place. I guess we don't have that compiler warning flag turned on for default configuration] >=20 > diff --git a/block/io.c b/block/io.c > index ed31810c0a..e5c6dc77d3 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -2464,7 +2464,6 @@ int coroutine_fn bdrv_co_pdiscard(BlockDriverStat= e *bs, int64_t offset, > assert(max_pdiscard >=3D bs->bl.request_alignment); > =20 > while (count > 0) { > - int ret; > int num =3D count; > =20 > if (head) { >=20 --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --IfAIVQvxPiBbsGacNVOkJFvS1NsjqnqIW 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/ iQEcBAEBCAAGBQJZY4ZGAAoJEKeha0olJ0NqGh8IAJO47Qx1/hEWWQRDjcD/q+UX 8lZ+7WxXRliiCZ6hWTu3/sf2LrByVOZaBGxVkWLXPshmBQch2vPleZLaotzViVtM mRTcBWr1N4tU1fBxS5yc2mYSRWTk7csXxPHkSkaPM4KB/qLYWt8HveoU3US3CQDV /Dm1i54881yLJXN9QjCrPsksJFEsd48ZVsRzfWMN9OPfh1Elq5RYgLhwOxEhJ3ZE tH/nZyXi9KUv5E7727Iq3xG8rgxcz+BPh/DX7rclgqFY6bv7RkvZx2soEje0kdpZ G37iQhOg7Y3SHV1GRAIaDz0fOGyu9cIs9Aodl/7j3zozQOElfjEIaTtbi5gzeHY= =2bON -----END PGP SIGNATURE----- --IfAIVQvxPiBbsGacNVOkJFvS1NsjqnqIW--