From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGqN0-0003Jv-MV for qemu-devel@nongnu.org; Wed, 06 Jan 2016 10:51:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGqMz-0007lM-TK for qemu-devel@nongnu.org; Wed, 06 Jan 2016 10:51:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGqMz-0007lD-Oi for qemu-devel@nongnu.org; Wed, 06 Jan 2016 10:51:29 -0500 Message-ID: <1452095486.6096.61.camel@redhat.com> From: Gerd Hoffmann Date: Wed, 06 Jan 2016 16:51:26 +0100 In-Reply-To: References: <1451994098-6972-1-git-send-email-kraxel@redhat.com> <1451994098-6972-8-git-send-email-kraxel@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v3 07/11] igd: revamp host config read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 > > + 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 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