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 <ari.kimari@tii.ae>
This commit is contained in:
Ari Kimari 2025-08-29 16:13:36 +03:00 committed by Petro Karashchenko
parent 8fea354a0f
commit 0ded247f44

View file

@ -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;
}