From 1ffe3b83a8c420170766959dabf1b9f6c05b6604 Mon Sep 17 00:00:00 2001 From: jzlv Date: Mon, 25 Oct 2021 15:19:47 +0800 Subject: [PATCH] [fix][bsp_common/fatfs] fix pointer assigning type in disk_ioctl function when cmd equal GET_SECTOR_SIZE or GET_BLOCK_SIZE --- bsp/bsp_common/fatfs/fatfs_spi_sd.c | 4 ++-- bsp/bsp_common/fatfs/fatfs_usb.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsp/bsp_common/fatfs/fatfs_spi_sd.c b/bsp/bsp_common/fatfs/fatfs_spi_sd.c index 6e8f4d67..457e4936 100644 --- a/bsp/bsp_common/fatfs/fatfs_spi_sd.c +++ b/bsp/bsp_common/fatfs/fatfs_spi_sd.c @@ -53,12 +53,12 @@ int sd_disk_ioctl(BYTE cmd, void *buff) break; case GET_SECTOR_SIZE: - *(DWORD *)buff = SD_CardInfo.CardBlockSize; + *(WORD *)buff = SD_CardInfo.CardBlockSize; result = RES_OK; break; case GET_BLOCK_SIZE: - *(WORD *)buff = SD_CardInfo.CardBlockSize; + *(DWORD *)buff = SD_CardInfo.CardBlockSize; result = RES_OK; break; diff --git a/bsp/bsp_common/fatfs/fatfs_usb.c b/bsp/bsp_common/fatfs/fatfs_usb.c index 1428fa9e..b4786fea 100644 --- a/bsp/bsp_common/fatfs/fatfs_usb.c +++ b/bsp/bsp_common/fatfs/fatfs_usb.c @@ -60,12 +60,12 @@ int usb_disk_ioctl(BYTE cmd, void *buff) break; case GET_SECTOR_SIZE: - *(DWORD *)buff = FLASH_BLOCK_SIZE; + *(WORD *)buff = FLASH_BLOCK_SIZE; result = RES_OK; break; case GET_BLOCK_SIZE: - *(WORD *)buff = 1; + *(DWORD *)buff = 1; result = RES_OK; break;