summaryrefslogtreecommitdiff
path: root/cmd/read.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-08-14 20:58:50 -0400
committerTom Rini <trini@konsulko.com>2017-08-20 09:54:30 -0400
commitd03618d5cbc3e1fb4f8c63f2e4966f825007ce08 (patch)
treefe40556e424d977d1985ffaece87f15bc6e05a81 /cmd/read.c
parent54f1792c8df1dba9cd41d811a7860ddd417f634e (diff)
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: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'cmd/read.c')
-rw-r--r--cmd/read.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/read.c b/cmd/read.c
index ecf925426f..82c2d9ad99 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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");
return 1;
}