Skip to content
Snippets Groups Projects
Commit d03618d5 authored by Tom Rini's avatar Tom Rini
Browse files

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 <philipp.tomsich@theobroma-systems.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: default avatarTom Rini <trini@konsulko.com>
parent 54f1792c
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ...@@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1; return 1;
} }
if (blk_dread(dev_desc, offset + blk, cnt, addr) < 0) { if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) {
printf("Error reading blocks\n"); printf("Error reading blocks\n");
return 1; return 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment