nuttx/fs/driver
Ansh Rai 54b0066a69 libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes
blksize_t is currently defined as int16_t, which overflows when a
filesystem reports a block size larger than 32767 bytes. This causes
st_blksize to become zero, leading to an integer divide-by-zero when
st_blocks is calculated in stat().

Widen blksize_t to int32_t to support larger filesystem block sizes.

Update nuttx_blksize_t in include/nuttx/fs/hostfs.h to keep it
consistent with include/sys/types.h.

struct geometry.geo_sectorsize (include/nuttx/fs/ioctl.h) is also
typed blksize_t, so every debug print of that field using a 16-bit
format specifier is updated to PRId32 to match the new width:
drivers/misc/ramdisk.c, drivers/mmcsd/mmcsd_spi.c, drivers/mtd/ftl.c,
fs/driver/fs_blockmerge.c, drivers/mtd/smart.c,
drivers/usbhost/usbhost_storage.c, drivers/mmcsd/mmcsd_sdio.c,
arch/arm/src/s32k1xx/s32k1xx_eeeprom.c,
arch/arm/src/lc823450/lc823450_mmcl.c.

Signed-off-by: Ansh Rai <anshrai331@gmail.com>
Signed-off-by: root <root@LAPTOP-9C7LKDC5.localdomain>
2026-07-16 23:37:22 +08:00
..
CMakeLists.txt fs/driver: Add a generic function to find a driver pointer by filesystem path 2025-10-11 00:47:02 +08:00
driver.h fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_blockmerge.c libs/libc: Fix divide-by-zero in stat() with large filesystem block sizes 2026-07-16 23:37:22 +08:00
fs_blockpartition.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_blockproxy.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_closeblockdriver.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_closemtddriver.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_findblockdriver.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_finddriver.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_findmtddriver.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_mtdpartition.c fs: migrate to SPDX identifier 2024-11-06 01:58:54 +08:00
fs_mtdproxy.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_openblockdriver.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
fs_registerblockdriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_registerdriver.c fs/fs.h: Add register_driver_with_size function 2025-11-13 08:57:52 -03:00
fs_registermtddriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_registerpipedriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_unregisterblockdriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_unregisterdriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_unregistermtddriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
fs_unregisterpipedriver.c fs: Move inotify.c from fs/notify/ to fs/vfs/ 2025-06-23 18:17:10 -03:00
Make.defs fs/driver: Add a generic function to find a driver pointer by filesystem path 2025-10-11 00:47:02 +08:00