From: Ian Jackson Subject: Re: [PATCH 4/4] libxenstat: qmp_read fix and cleanup Date: Wed, 8 Apr 2015 16:52:01 +0100 Message-ID: <21797.20129.818926.157082@mariner.uk.xensource.com> References: <1428505275-6563-1-git-send-email-wei.liu2@citrix.com> <1428505275-6563-5-git-send-email-wei.liu2@citrix.com> <55254852.4010204@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55254852.4010204@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Charles Arnold , Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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.