Skip to content

Commit a9f5d88

Browse files
committed
fatfs: Fix unaligned access in disk_ioctl
Unlike the other disk_ioctl options, GET_SECTOR_SIZE is interpreted as a 16-bit WORD, instead of a 32-bit DWORD. This caused an unaligned access error on M0 platforms.
1 parent e907079 commit a9f5d88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: features/filesystem/fat/FATFileSystem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
216216
if (_ffs[pdrv] == NULL) {
217217
return RES_NOTRDY;
218218
} else {
219-
DWORD size = _ffs[pdrv]->get_erase_size();
220-
*((DWORD*)buff) = size;
219+
WORD size = _ffs[pdrv]->get_erase_size();
220+
*((WORD*)buff) = size;
221221
return RES_OK;
222222
}
223223
case GET_BLOCK_SIZE:

0 commit comments

Comments
 (0)