Skip to content

Commit d03618d

Browse files
committed
cmd/read.c: Fix checking blk_dread return value
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. Reported-by: Coverity (CID: 166335) Cc: Philipp Tomsich <[email protected]> Cc: Simon Glass <[email protected]> Cc: Bin Meng <[email protected]> Signed-off-by: Tom Rini <[email protected]>
1 parent 54f1792 commit d03618d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/read.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
6666
return 1;
6767
}
6868

69-
if (blk_dread(dev_desc, offset + blk, cnt, addr) < 0) {
69+
if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) {
7070
printf("Error reading blocks\n");
7171
return 1;
7272
}

0 commit comments

Comments
 (0)