From: Ian Jackson Subject: Re: [PATCH V5 2/7] libxl_read_file_contents: add new entry to read sysfs file Date: Thu, 25 Jun 2015 12:09:00 +0100 Message-ID: <21899.57676.368102.982820@mariner.uk.xensource.com> References: <1435226838-3067-1-git-send-email-cyliu@suse.com> <1435226838-3067-3-git-send-email-cyliu@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1435226838-3067-3-git-send-email-cyliu@suse.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: Chunyan Liu Cc: jgross@suse.com, wei.liu2@citrix.com, ian.campbell@citrix.com, george.dunlap@eu.citrix.com, xen-devel@lists.xen.org, jfehlig@suse.com List-Id: xen-devel@lists.xenproject.org Chunyan Liu writes ("[PATCH V5 2/7] libxl_read_file_contents: add new entry to read sysfs file"): > Sysfs file has size=4096 but actual file content is less than that. > Current libxl_read_file_contents will treat it as error when file size > and actual file content differs, so reading sysfs file content with > this function always fails. > > Add a new entry libxl_read_sysfs_file_contents to handle sysfs file > specially. It would be used in later pvusb work. I think this still fails to detect a situation where the file is unexpectedly longer than the requested size ? As we wrote earlier: > > > Is there any risk that the file is actually bigger than advertised, > > > rather than smaller ? > > > > For sysfs file, couldn't be bigger. > > Then you should detect the condition that the file is bigger, and call > it an error. Thanks, Ian.