[U-Boot] fs: ext4: fix writing zero-length files

Tom Rini trini at ti.com
Thu Jun 19 17:21:04 CEST 2014


On Wed, Jun 11, 2014 at 12:46:16PM -0600, Stephen Warren wrote:

> From: Stephen Warren <swarren at nvidia.com>
> 
> ext4fs_allocate_blocks() always allocates at least one block for a file.
> If the file size is zero, this causes total_remaining_blocks to
> underflow, which then causes an apparent hang while 2^32 blocks are
> allocated.
> 
> To solve this, check that total_remaining_blocks is non-zero as part of
> the loop condition (i.e. before each loop) rather than at the end of
> the loop.
> 
> Signed-off-by: Stephen Warren <swarren at nvidia.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140619/d830e127/attachment.pgp>


More information about the U-Boot mailing list