Received: from eggs.gnu.org ([2001:4830:134:3::10]:57555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNNrj-0002gx-8x for qemu-devel@nongnu.org; Fri, 29 Aug 2014 11:13:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNNrd-00029T-4m for qemu-devel@nongnu.org; Fri, 29 Aug 2014 11:13:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNNrc-00029G-S6 for qemu-devel@nongnu.org; Fri, 29 Aug 2014 11:13:21 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7TFDKIP000774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 29 Aug 2014 11:13:20 -0400 Date: Fri, 29 Aug 2014 16:13:17 +0100 From: Stefan Hajnoczi Message-ID: <20140829151317.GB18292@stefanha-thinkpad.redhat.com> References: <1409213061-15562-1-git-send-email-rjones@redhat.com> <1409213061-15562-2-git-send-email-rjones@redhat.com> <20140829090359.GA32448@stefanha-thinkpad.redhat.com> <20140829091904.GW1302@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XF85m9dhOBO43t/C" Content-Disposition: inline In-Reply-To: <20140829091904.GW1302@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] curl: Don't deref NULL pointer in call to aio_poll. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: pbonzini@redhat.com, famz@redhat.com, qemu-devel@nongnu.org --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 29, 2014 at 10:19:04AM +0100, Richard W.M. Jones wrote: > On Fri, Aug 29, 2014 at 10:03:59AM +0100, Stefan Hajnoczi wrote: > > On Thu, Aug 28, 2014 at 09:04:21AM +0100, Richard W.M. Jones wrote: > > > diff --git a/block/curl.c b/block/curl.c > > > index d4b85d2..f59615d 100644 > > > --- a/block/curl.c > > > +++ b/block/curl.c > > > @@ -352,7 +352,7 @@ static void curl_multi_timeout_do(void *arg) > > > #endif > > > } > > > =20 > > > -static CURLState *curl_init_state(BDRVCURLState *s) > > > +static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLStat= e *s) > > > { > > > CURLState *state =3D NULL; > > > int i, j; > >=20 > > Why add the BDRVCURLState *s argument... > >=20 > > > @@ -370,7 +370,7 @@ static CURLState *curl_init_state(BDRVCURLState *= s) > > > break; > > > } > > > if (!state) { > > > - aio_poll(state->s->aio_context, true); > > > + aio_poll(bdrv_get_aio_context(bs), true); > > > } > > > } while(!state); > > > =20 > >=20 > > ...if it is not used? >=20 > I may be misunderstanding this, but BDRVCURLState *s is used elsewhere > in the function. >=20 > However there is a potential to derive `BDRVCURLState *s =3D bs->opaque;' > if that's what you meant? Sorry, I misread the code. I thought you added s but you really added bs. That's fine and it makes sense now :). Stefan --XF85m9dhOBO43t/C Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUAJiNAAoJEJykq7OBq3PIZQsH/iOx8NwO2HoeYwT4kuaPSog1 mK5mzWsKS9J0871CT3DKqOP8gY3PLsVPJ0C57eJDNyialnFdvwZOkg/TSzOHUMdP XfDmnqsRttmuC65QBk6IvDbA9oxpNURhD13oV3aY7AVMmSvpWgHcnVyC/dkW90N0 rRoNJo6DJukXhvkWvKeP9DtzuNMNrgyR2fd7k0HWd9Nvzv3jsnvZoQzRFbv+vEIm YJQR6ha+I1e/UKicX78bjpbQjyCfUR3622WtNheiSlrfv+53W2AXE7yQHE7QBxqh lb/8WthTnzQ1VZ31Pr7wPQgNo8vaTcmmgMxnMkTnWuJNIdezHbU7uijnKFMR3ss= =a1LF -----END PGP SIGNATURE----- --XF85m9dhOBO43t/C--