From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1fzQ-0005Sj-BP for qemu-devel@nongnu.org; Mon, 30 Jun 2014 14:07:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1fzK-0005Qo-L2 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 14:07:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1fzK-0005PR-As for qemu-devel@nongnu.org; Mon, 30 Jun 2014 14:07:34 -0400 Message-ID: <53B1A760.5070806@redhat.com> Date: Mon, 30 Jun 2014 12:07:28 -0600 From: Eric Blake MIME-Version: 1.0 References: <1404151417-474-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1404151417-474-1-git-send-email-peter.maydell@linaro.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XULestpmuEHoqcVpFTbUDMf0wITfxtFk6" Subject: Re: [Qemu-devel] [PATCH for-2.1] block/cow: Avoid use of uninitialized cow_bs in error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: Dong Xu Wang , Chunyan Liu , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XULestpmuEHoqcVpFTbUDMf0wITfxtFk6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/30/2014 12:03 PM, Peter Maydell wrote: > Commit 25814e8987 introduced an error-exit code path which does > a "goto exit" before the cow_bs variable is initialized, meaning > we would call bdrv_unref() on an uninitialized variable and > likely segfault. Fix this by moving the NULL-initialization > to the top of the function and making the exit code path handle > the case where it is NULL. >=20 > Signed-off-by: Peter Maydell > --- > block/cow.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Reviewed-by: Eric Blake (and I obviously missed catching this on my first review of the patch) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XULestpmuEHoqcVpFTbUDMf0wITfxtFk6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTsadgAAoJEKeha0olJ0Nq9rgH/R8LZz7Zv0KITyzftFbpy1yK rgIL82LlZtpq4pGHSXrgtmpQNf33oy3li6n1NQVR93MbXlKWdGY55yYhsXujLsCS gImFCU/A6fBgb7dPzJ44BV1osO4dxazWnDaBLC4acrSg/sXufVSDzb6MQUMJQ8iT DBk8IjoLklq+tmM07NDHtEfqlOI+JPDloSsFcwolJn8KSKfEYySGHVGZanGOJrDx xKiLafj5Un/oPIBl/XpKnb9joZ2DE1O2T10/X0lnjhZ+aHF13wysci7kn6oE6nxW os0TQul9gIEPJtTD4zerpa4e2AqBUBqVaYbeAEnF1Q4SybO2w2MrAErjsiU8QpQ= =LVqd -----END PGP SIGNATURE----- --XULestpmuEHoqcVpFTbUDMf0wITfxtFk6--