From: Reinhard Arlt <reinhard.arlt@t-online.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] WARNING: in ext2fs.c
Date: Fri, 30 Sep 2005 00:22:57 +0200 [thread overview]
Message-ID: <433C6941.8090908@t-online.de> (raw)
In-Reply-To: <5F98E47AD7B1C349895ED4E2EDF3918B01F29219@stca209a>
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
>
prev parent reply other threads:[~2005-09-29 22:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-29 19:47 [U-Boot-Users] WARNING: in ext2fs.c Roberts, John
2005-09-29 22:22 ` Reinhard Arlt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=433C6941.8090908@t-online.de \
--to=reinhard.arlt@t-online.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox