This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 0ded247f44 fs/fat: Fix wrong alloc used in fat_zero_cluster()
0ded247f44 is described below
commit 0ded247f442f08656c8738ac6dcb2ef4308d7261
Author: Ari Kimari <[email protected]>
AuthorDate: Fri Aug 29 16:13:36 2025 +0300
fs/fat: Fix wrong alloc used in fat_zero_cluster()
Fat_zero_cluster() use fs_heap_malloc() for buffer that
is used to call fat_hwread().
Fat_hwread() must be called with IO buffer that have proper
alingment because it might use DMA.
Fix changes fs_heap_malloc() to fat_io_alloc() which uses
correct fat_dma_alloc() if CONFIG_FAT_DMAMEMORY is defined.
Signed-off-by: Ari Kimari <[email protected]>
---
fs/fat/fs_fat32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c
index 39eca06e04..22db4a9786 100644
--- a/fs/fat/fs_fat32.c
+++ b/fs/fat/fs_fat32.c
@@ -509,7 +509,7 @@ static int fat_zero_cluster(FAR struct fat_mountpt_s *fs,
int cluster,
off_t end_sec = sector + DIV_ROUND_UP(end, fs->fs_hwsectorsize);
int ret;
- buf = fs_heap_malloc(fs->fs_hwsectorsize);
+ buf = fat_io_alloc(fs->fs_hwsectorsize);
if (!buf)
{
return -ENOMEM;
@@ -548,7 +548,7 @@ static int fat_zero_cluster(FAR struct fat_mountpt_s *fs,
int cluster,
ret = OK;
out:
- fs_heap_free(buf);
+ fat_io_free(buf, fs->fs_hwsectorsize);
return ret;
}