[PATCH 21/26] fs: fat: fix garbage read when writing with bigger block size
Ahmad Fatoum
a.fatoum at barebox.org
Fri Jun 26 01:42:32 PDT 2026
fs->win has the size of the biggest supported sector, but regardless,
only the first 512 bytes were actually zeroed.
Extend the zeroing to cover the whole buffer.
Assisted-by: Codex:gpt-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
fs/fat/ff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fat/ff.c b/fs/fat/ff.c
index c8d57ce50054..89b4f9fa5de7 100644
--- a/fs/fat/ff.c
+++ b/fs/fat/ff.c
@@ -292,7 +292,7 @@ int sync ( /* 0: successful, -EIO: failed */
if (fs->fs_type == FS_FAT32 && fs->fsi_flag) {
fs->winsect = 0;
/* Create FSInfo structure */
- memset(fs->win, 0, 512);
+ memset(fs->win, 0, SS(fs));
ST_WORD(fs->win+BS_55AA, 0xAA55);
ST_DWORD(fs->win+FSI_LeadSig, 0x41615252);
ST_DWORD(fs->win+FSI_StrucSig, 0x61417272);
--
2.47.3
More information about the barebox
mailing list