Commit d03618d5cbc3e1fb4f8c63f2e4966f825007ce08

Authored by Tom Rini
1 parent 54f1792c8d

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>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

... ... @@ -66,7 +66,7 @@
66 66 return 1;
67 67 }
68 68  
69   - if (blk_dread(dev_desc, offset + blk, cnt, addr) < 0) {
  69 + if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) {
70 70 printf("Error reading blocks\n");
71 71 return 1;
72 72 }