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

Re: [Xen-devel] [PATCH 4/4] libxenstat: qmp_read fix and cleanup



Andrew Cooper writes ("Re: [PATCH 4/4] libxenstat: qmp_read fix and cleanup"):
> On 08/04/15 16:01, Wei Liu wrote:
> > The second argument of poll(2) is the number of file descriptors. POLLIN
> > is defined as 1 so it happens to work.
...
> > @@ -311,6 +312,9 @@ static int qmp_read(int qfd, unsigned char **qstats)
> >                     ptr[qsize] = 0;
> >                     *qstats = ptr;
> >             }
> > +           memset(pfd, 0, sizeof(pfd));
> > +           pfd[0].fd = qfd;
> > +           pfd[0].events = POLLIN;
> 
> I don't think this is necessary.  .fd and .events should be untouched by
> poll().

Indeed.

> Ignore the complaint about revents being uninitialised.  That is because
> Coverity doesn't have a model for poll(), and doesn't know that poll()
> writes to revents.

I would be happy with the patch either with or without the memset.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.