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

Re: [Xen-devel] [PATCH V5 2/7] libxl_read_file_contents: add new entry to read sysfs file




>>> On 6/25/2015 at 07:09 PM, in message
<21899.57676.368102.982820@xxxxxxxxxxxxxxxxxxxxxxxx>, Ian Jackson
<Ian.Jackson@xxxxxxxxxxxxx> wrote: 
> 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 ? 


+            } else if (feof(f)) {
+                if (rs < datalen && tolerate_shrinking_file) {
+                    datalen = rs;
+                } else {

If the file is bigger than the requested size, it will fall to this branch and 
report error.
Do you mean I should report another error message separately?

- Chunyan

+                    LOG(ERROR, "%s changed size while we were reading it",
+                        filename);
+                    goto xe;
+                }
+            } else {

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



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