Skip to contentSkip to conversation

fs/fat: Correct blk_dread() return value check

PATCH In review Tom Rini 1 participant 2 messages Aug 15, 2017 – Aug 20, 2017 VFAT/FAT/msdos filesystem

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 fs/fat: Correct blk_dread() return value check

The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check.

---
 fs/fat/fat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fat/fat.c +1 -1
index 9ad18f96ff07..465a6875edf5 100644
@@ -54,7 +54,7 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
 
 	ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf);
 
-	if (nr_blocks && ret == 0)
+	if (ret != nr_blocks)
 		return -1;
 
 	return ret;
Signature · 1 line
1.9.1
author
#1 lore raw
Quoted 5 lines · Tom Rini

The function blk_dread will return -ENOSYS on failure or on success the number of blocks read, which must be the number asked to read (otherwise it failed somewhere). Correct this check.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170820/0b7f439d/attachment.sig>