From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMl0F-0003rQ-3E for qemu-devel@nongnu.org; Wed, 27 Aug 2014 17:43:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMl06-0002cT-1w for qemu-devel@nongnu.org; Wed, 27 Aug 2014 17:43:39 -0400 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:52936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMl05-0002cJ-RV for qemu-devel@nongnu.org; Wed, 27 Aug 2014 17:43:29 -0400 Received: by mail-wi0-f180.google.com with SMTP id ex7so182370wid.7 for ; Wed, 27 Aug 2014 14:43:29 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53FE50F9.1090600@redhat.com> Date: Wed, 27 Aug 2014 23:43:21 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409160687-32212-1-git-send-email-rjones@redhat.com> <1409160687-32212-2-git-send-email-rjones@redhat.com> In-Reply-To: <1409160687-32212-2-git-send-email-rjones@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] 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" , qemu-devel@nongnu.org Cc: stefanha@redhat.com Il 27/08/2014 19:31, Richard W.M. Jones ha scritto: > Signed-off-by: Richard W.M. Jones > --- > block/curl.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/block/curl.c b/block/curl.c > index 46f1082..8b69f28 100644 > --- a/block/curl.c > +++ b/block/curl.c > @@ -355,7 +355,7 @@ static void curl_multi_timeout_do(void *arg) > #endif > } > > -static CURLState *curl_init_state(BDRVCURLState *s) > +static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s) > { > CURLState *state = NULL; > int i, j; > @@ -373,7 +373,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); > > @@ -552,7 +552,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, > DPRINTF("CURL: Opening %s\n", file); > s->aio_context = bdrv_get_aio_context(bs); > s->url = g_strdup(file); > - state = curl_init_state(s); > + state = curl_init_state(bs, s); > if (!state) > goto out_noclean; > > @@ -636,7 +636,7 @@ static void curl_readv_bh_cb(void *p) > } > > // No cache found, so let's start a new request > - state = curl_init_state(s); > + state = curl_init_state(acb->common.bs, s); > if (!state) { > acb->common.cb(acb->common.opaque, -EIO); > qemu_aio_release(acb); > This looks good, thanks. Reviewed-by: Paolo Bonzini