diff options
author | Benoît Thébaudeau <benoit@wsystem.com> | 2015-09-28 13:45:28 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-10-11 21:12:07 (GMT) |
commit | 8133f43d1cd4f0df0a6b4c2aa99a47753fda20d6 (patch) | |
tree | f997889253a26ce2d463fee41d4e44fb9329ec1c /common/cmd_boot.c | |
parent | 689821fd766fb4855deafd04eaffeef5b2c6579e (diff) | |
download | u-boot-fsl-qoriq-8133f43d1cd4f0df0a6b4c2aa99a47753fda20d6.tar.xz |
fs/fat/fat_write: Fix buffer alignments
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@wsystem.com>
Diffstat (limited to 'common/cmd_boot.c')
0 files changed, 0 insertions, 0 deletions