qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] curl: Don't deref NULL pointer in call to ai


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2] curl: Don't deref NULL pointer in call to aio_poll.
Date: Fri, 29 Aug 2014 16:13:17 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

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
> > >  }
> > >  
> > > -static CURLState *curl_init_state(BDRVCURLState *s)
> > > +static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s)
> > >  {
> > >      CURLState *state = NULL;
> > >      int i, j;
> > 
> > Why add the BDRVCURLState *s argument...
> > 
> > > @@ -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);
> > >  
> > 
> > ...if it is not used?
> 
> I may be misunderstanding this, but BDRVCURLState *s is used elsewhere
> in the function.
> 
> However there is a potential to derive `BDRVCURLState *s = 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

Attachment: pgpT8ujUKEP0K.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]