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

Re: [Xen-devel] [PATCH v7 06/14] libxl_qmp: Implementation of libxl__ev_qmp_*



On Fri, Jan 04, 2019 at 11:21:11AM +0000, Ian Jackson wrote:
> Anthony PERARD writes ("Re: [PATCH v7 06/14] libxl_qmp: Implementation of 
> libxl__ev_qmp_*"):
> > On Fri, Dec 21, 2018 at 03:36:18PM +0000, Ian Jackson wrote:
> > > > +    while (ev->tx_buf_off < ev->tx_buf_len) {
> > > > +        r = write(fd, ev->tx_buf + ev->tx_buf_off,
> > > > +                  ev->tx_buf_len - ev->tx_buf_off);
> > > > +        if (r < 0) {
> > > > +            if (errno == EINTR)
> > > > +                continue;
> > > > +            if (errno == EWOULDBLOCK)
> > > > +                break;
> > > > +            LOGED(ERROR, ev->domid, "failed to write to QMP socket");
> > > > +            return ERROR_FAIL;
> > > > +        }
> > > > +        ev->tx_buf_off += r;
> > > 
> > > Can you assert that the value of r was within range ?  (Perhaps this
> > > is paranoia on my part, but, still.)
> > 
> > I do assert the value of tx_buf_off which does include r.
> > But I can add
> > `assert(r > 0 && r <= (ev->rx_buf_size - ev->rx_buf_used));'.
> 
> Yes.  As I say worrying that write() might return something insane is
> perhaps paranoia.
> 
> Do you mean `ev->tx_buf_len - ev->tx_buf_off' like in the write call ?

I was looking at the wrong function :(.

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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