fs/fat: fix unaligned access regression
PATCH 1/1 fs/fat: fix unaligned access regression
Since2460098cffacd18729262e3ed36656e6943783ed (fs/fat: Reduce stack usage) Trying to load a file off a FAT fs on i.MX 6 based CuBox-i4Pro fails:
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
CACHE: Misaligned operation at range [8f89da30, 8f89e230]
CACHE: Misaligned operation at range [8f89da30, 8f89e230]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89da30
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e230
CACHE: Misaligned operation at range [8f89da30, 8f89e230]
CACHE: Misaligned operation at range [8f89da30, 8f89e230]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89da30
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e230
CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0, 8f89e4a0]
CACHE: Misaligned operation at range [8f89dc68, 8f89e468]
CACHE: Misaligned operation at range [8f89dc68, 8f89e468]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x8f89dc68
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x8f89e468
...
Switching the malloc() calls to malloc_cache_aligned() avoids the alignment errors and allows booting to continue.
--- fs/fat/fat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/fat/fat.c +3 -3
@@ -1038,7 +1038,7 @@ int fat_exists(const char *filename)fat_itr *itr;int ret; - itr =malloc (sizeof (fat_itr)); + itr =malloc_cache_aligned (sizeof (fat_itr)); ret =fat_itr_root (itr, &fsdata);if (ret)return 0 ;
@@ -1055,7 +1055,7 @@ int fat_size(const char *filename, loff_t *size)fat_itr *itr;int ret; - itr =malloc (sizeof (fat_itr)); + itr =malloc_cache_aligned (sizeof (fat_itr)); ret =fat_itr_root (itr, &fsdata);if (ret)return ret;
@@ -1089,7 +1089,7 @@ int file_fat_read_at(const char *filename, loff_t pos, void *buffer,fat_itr *itr;int ret; - itr =malloc (sizeof (fat_itr)); + itr =malloc_cache_aligned (sizeof (fat_itr)); ret =fat_itr_root (itr, &fsdata);if (ret)return ret;
Signature · 1 line
2.14.2
PATCH 1/1 fs/fat: fix unaligned access regression
Quoted 25 lines · Jonathan Gray
Since
2460098cffacd18729262e3ed36656e6943783ed(fs/fat: Reduce stack usage) Trying to load a file off a FAT fs on i.MX 6 based CuBox-i4Pro fails:switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
CACHE: Misaligned operation at range [8f89da30,8f89e230]
CACHE: Misaligned operation at range [8f89da30,8f89e230]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89da30
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e230
CACHE: Misaligned operation at range [8f89da30,8f89e230]
CACHE: Misaligned operation at range [8f89da30,8f89e230]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89da30
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e230
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dc68,8f89e468]
CACHE: Misaligned operation at range [8f89dc68,8f89e468]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89dc68
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e468
...
Quoted 4 lines
Switching the
malloc()calls tomalloc_cache_aligned()avoids the alignment errors and allows booting to continue.Signed-off-by Jonathan Gray <[email protected]>
Tom has just applied the same fix:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=09fa964bba80c45432660f0e64362181900a5aef;hp=99e46dfc6a9176f6f0680c9dfdf33c97d56336ce
PATCH 1/1 fs/fat: fix unaligned access regression
Quoted 26 lines · Fabio Estevam
Quoted 25 lines · Jonathan Gray
Since
2460098cffacd18729262e3ed36656e6943783ed(fs/fat: Reduce stack usage) Trying to load a file off a FAT fs on i.MX 6 based CuBox-i4Pro fails:switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
CACHE: Misaligned operation at range [8f89da30,8f89e230]
CACHE: Misaligned operation at range [8f89da30,8f89e230]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89da30
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e230
CACHE: Misaligned operation at range [8f89da30,8f89e230]
CACHE: Misaligned operation at range [8f89da30,8f89e230]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89da30
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e230
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dca0,8f89e4a0]
CACHE: Misaligned operation at range [8f89dc68,8f89e468]
CACHE: Misaligned operation at range [8f89dc68,8f89e468]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x8f89dc68
ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x8f89e468
...
Quoted 7 lines
Quoted 4 lines
Switching the
malloc()calls tomalloc_cache_aligned()avoids the alignment errors and allows booting to continue.Signed-off-by Jonathan Gray <[email protected]>Tom has just applied the same fix:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=09fa964bba80c45432660f0e64362181900a5aef;hp=99e46dfc6a9176f6f0680c9dfdf33c97d56336ce
Oh heck, now I'm embarrassed for not recalling we had the same issue with a fix in the queue, sorry!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171009/69305a72/attachment.sig>