From: DENX Support System Date: Wed, 5 Apr 2006 13:40:05 +0200 Subject: [DNX#2006040142000964] [U-Boot-Users] WARNING: in ext2fs.c (fwd) Message-ID: <1144237205.114453.917308733@castor.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello list, inside the automatic U-Boot patch tracking system a follow up to [DNX#2006040142000964] was entered through the web interface: > Hello, > > the fix for this bug should be in GIT tree... > > Reinhard > > DENX Support System wrote: > > Hello list, > > > > inside the automatic U-Boot patch tracking system a follow up > > to [DNX#2006040142000964] was entered through the web interface: > > > > > > > >>------- Forwarded Message > >> > >>Date: Fri, 30 Sep 2005 00:22:57 +0200 > >>From: Reinhard Arlt > >>cc: "'u-boot-users at lists.sourceforge.net'" > >> >> .net> > >>Subject: Re: [U-Boot-Users] WARNING: in ext2fs.c > >> > >>Hello, > >> > >>this is a bug on bigendian machines, Who prepares a patch? > >> > >>Best regards > >> > >>Reinhard > >> > >>Roberts, John wrote: > >> > >>> In function: ext2fs_read_file(ext2fs_node_t node, int pos, unsigned > >>>int len, char *buf) > >>> > >>> You may not be getting all the bytes you requested in the 'len' > >>>parameter. Your requested length might be improperly adjusted. > >>> ----------------------- Code snippet ------------- > >>> unsigned int filesize = node->inode.size; > >>> > >>> /* Adjust len so it we can't read past the end of the file. */ > >>> if (len > filesize) { > >>> len = filesize; > >>> } > >>>----------------------------------------------------------- > >>> > >>>"len" is the native requested size, while "filesize" is the files real size, > >>>but byte-swapped and the two are being compared. As long as the byte-swapped > >>>length value is larger than the requested size value, then you'll never have > >>>a problem. > >>> > >>>Now assume the file is 2meg and you requested 2meg. > >>> > >>>IF( len=200000 (2meg) > filesize=2000(2meg byte-swapped) ) > >>>THEN len = filesize > >>> > >>>You end up getting only 2000 bytes. > >>> > >>> The initialization of filesize should be: > >>> unsigned int filesize = __le32_to_cpu (node->inode.size); > >>> Not: > >>> unsigned int filesize = node->inode.size; > >>> > >>> (440gx) > >>> -John Roberts > >>> > >>> > >>> > >>> > >>> > >>>------------------------------------------------------- > >>>This SF.Net email is sponsored by: > >>>Power Architecture Resource Center: Free content, downloads, discussions, > >>>and more. http://solutions.newsforge.com/ibmarch.tmpl > >>>_______________________________________________ > >>>U-Boot-Users mailing list > >>>U-Boot-Users at lists.sourceforge.net > >>>https://lists.sourceforge.net/lists/listinfo/u-boot-users > >>> > >> > >> > >> > >>------------------------------------------------------- > >>This SF.Net email is sponsored by: > >>Power Architecture Resource Center: Free content, downloads, > >>discussions, > >>and more. http://solutions.newsforge.com/ibmarch.tmpl > >>_______________________________________________ > >>U-Boot-Users mailing list > >>U-Boot-Users at lists.sourceforge.net > >>https://lists.sourceforge.net/lists/listinfo/u-boot-users > >> > >> > >>------- End of Forwarded Message > > > > > > > > Your U-Boot support team > > Your U-Boot support team