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

Re: [Xen-devel] [PATCH v3 07/11] igd: revamp host config read



On Wed, 6 Jan 2016, Gerd Hoffmann wrote:
> > > +    for (i = 0; i < len; i++) {
> > > +        rc = pread(config_fd, guest->config + list[i].offset,
> > > +                   list[i].len, list[i].offset);
> > > +        if (rc != list[i].len) {
> > 
> > pread is allowed to return early, returning the number of bytes read.
> > 
> 
> This is a sysfs file though, not a socket or pipe where a partial read
> makes sense and will actually happen.  If we can't read something
> that'll be because the kernel denies access.
> 
> So IMHO it should be fine to treat anything which doesn't give us the
> amount of bytes we asked for as an error condition.

True, still theoretically, it's possible for pread to return early. Who
knows what glibc and linux are going to do in the future.

_______________________________________________
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®.