Skip to contentSkip to conversation

Revert "ext4fs: Fix: Read outside partition error"

PATCH In review Tom Rini 1 participant 2 messages May 26, 2025 – May 27, 2025 ext4 file system

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 Revert "ext4fs: Fix: Read outside partition error"

The issue here is that the function read_allocated_block() will report problems via a negative return value. If we say the return value is stored in an lbaint_t that can no longer happen (and Coverity discovered this by reporting a no effect comparison and then dead code). The problem being fixed by allowing for storing a larger block number will have to be solved in some other manner.

This reverts commit df2ed552f0b05591090369a7fe7ddc92439dea5c.

Addresses-Coverity-ID: 131183

---
Cc: Tony Dinh <[email protected]>

---
 fs/ext4/ext4fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4fs.c +1 -1
index f10c622e62c5..1727da2dc6db 100644
@@ -101,7 +101,7 @@ int ext4fs_read_file(struct ext2fs_node *node, loff_t pos,
 	blockcnt = lldiv(((len + pos) + blocksize - 1), blocksize);
 
 	for (i = lldiv(pos, blocksize); i < blockcnt; i++) {
-		lbaint_t blknr;
+		long int blknr;
 		int blockoff = pos - (blocksize * i);
 		int blockend = blocksize;
 		int skipfirst = 0;
Signature · 1 line
2.43.0
author
#1 lore raw
Quoted 8 lines · Tom Rini

The issue here is that the function read_allocated_block() will report problems via a negative return value. If we say the return value is stored in an lbaint_t that can no longer happen (and Coverity discovered this by reporting a no effect comparison and then dead code). The problem being fixed by allowing for storing a larger block number will have to be solved in some other manner.

[...]

Applied to u-boot/master, thanks!

[1/1] Revert "ext4fs: Fix: Read outside partition error"

      commit: e04d137231f2e9e14708a32448c879125b8e308f
Signature · 1 line
Tom