Skip to content

Commit 94aea46

Browse files
gekyadbridge
authored andcommitted
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 a35baf2 commit 94aea46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

features/filesystem/fat/FATFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
219219
if (_ffs[pdrv] == NULL) {
220220
return RES_NOTRDY;
221221
} else {
222-
DWORD size = _ffs[pdrv]->get_erase_size();
223-
*((DWORD*)buff) = size;
222+
WORD size = _ffs[pdrv]->get_erase_size();
223+
*((WORD*)buff) = size;
224224
return RES_OK;
225225
}
226226
case GET_BLOCK_SIZE:

0 commit comments

Comments
 (0)