Skip to contentSkip to conversation

fs: fs_devread should log error when read outside partition

PATCH In review Tony Dinh 2 participants 3 messages May 20, 2025 – May 23, 2025 VFS

lore
Share & tools
lore

Tony Dinh

author
#0 lore raw

cover fs: fs_devread should log error when read outside partition

Currently there is a bug in u-boot Ext4 filesystem driver that causes a "read outside partition" error. This bug only shows when the HDD is greater than 2TB in capacity (i.e. driver using uint64 lbaint_t). But all users will see is u-boot silently failed to read the HDD file system directory.

For example, ext4ls command will return with an empty directory list, and without any indication that the command has failed.

This was tested with the Synology DS116 (Armada 385) board, and a 4TB Seagate HDD. Linux kernel 6.14.6 Ext4 driver handles the same 4TB HDD correctly.

Tony Dinh (1):
fs: fs_devread should log error when read outside partition

 fs/fs_internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 4 lines
2.39.5

base-commit: 126a88d49bcae04bbfc0d6723097cd6341355ade
branch: master
author
#1 lore raw

PATCH 1/1 fs: fs_devread should log error when read outside partition

Log the error if fs_devread() fails when trying to reading outside partition. This will make bug reporting easier.

---

 fs/fs_internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fs_internal.c +1 -1
index ab4847ac257..ff27c564efc 100644
@@ -28,7 +28,7 @@ int fs_devread(struct blk_desc *blk, struct disk_partition *partition,
 	/* Check partition boundaries */
 	if ((sector + ((byte_offset + byte_len - 1) >> log2blksz))
 	    >= partition->size) {
-		log_debug("read outside partition " LBAFU "\n", sector);
+		log_err("** Read outside partition " LBAFU "\n", sector);
 		return 0;
 	}
 
Signature · 1 line
2.39.5
#2 lore raw
Quoted 4 lines · Tony Dinh

Log the error if fs_devread() fails when trying to reading outside partition. This will make bug reporting easier.

Applied to u-boot/master, thanks!

[1/1] fs: fs_devread should log error when read outside partition

      commit: ec3ce603cd9840492d60230f164533ad4574489f
Signature · 1 line
Tom