[U-Boot] [U-Boot,1/5] fs/fat/fat_write: Fix buffer alignments

Tom Rini trini at konsulko.com
Mon Oct 12 17:15:11 CEST 2015


On Mon, Sep 28, 2015 at 03:45:28PM +0200, Benoît Thébaudeau wrote:

> set_cluster() was using a temporary buffer without enforcing its
> alignment for DMA and cache. Moreover, it did not check the alignment of
> the passed buffer, which can come directly from applicative code or from
> the user.
> 
> This could cause random data corruption, which has been observed on
> i.MX25 writing to an SD card.
> 
> Fix this by only passing ARCH_DMA_MINALIGN-aligned buffers to
> disk_write(), which requires the introduction of a buffer bouncing
> mechanism for the misaligned buffers passed to set_cluster().
> 
> By the way, improve the handling of the corresponding return values from
> disk_write():
>  - print them with debug() in case of error,
>  - consider that there is an error is disk_write() returns a smaller
>    block count than the requested one, not only if its return value is
>    negative.
> 
> After this change, set_cluster() and get_cluster() are almost
> symmetrical.
> 
> Signed-off-by: Benoît Thébaudeau <benoit at wsystem.com>

Applied to u-boot/master, thanks!

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


More information about the U-Boot mailing list