From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [PATCH v3 07/11] igd: revamp host config read Date: Wed, 06 Jan 2016 16:51:26 +0100 Message-ID: <1452095486.6096.61.camel@redhat.com> References: <1451994098-6972-1-git-send-email-kraxel@redhat.com> <1451994098-6972-8-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org To: Stefano Stabellini Cc: igvt-g@ml01.01.org, xen-devel@lists.xensource.com, Eduardo Habkost , qemu-devel@nongnu.org, Cao jin , vfio-users@redhat.com List-Id: xen-devel@lists.xenproject.org > > + for (i =3D 0; i < len; i++) { > > + rc =3D pread(config_fd, guest->config + list[i].offset, > > + list[i].len, list[i].offset); > > + if (rc !=3D list[i].len) { >=20 > pread is allowed to return early, returning the number of bytes read. >=20 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. cheers, Gerd