UPSTREAM: vboot/vbnv_flash: fix return value check for rdev_writeat()

The return value check was incorect and checking for failure
in the success path. Fix the return value check so that it
actually checks for success.

BUG=chrome-os-partner:56151
BRANCH=None
TEST=None

Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/16303
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>

Change-Id: Ie7960b89a916dec261015c97c3e0552be56b5b5d
Reviewed-on: https://chromium-review.googlesource.com/374468
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Aaron Durbin 2016-08-23 13:22:17 -05:00 committed by chrome-bot
parent 05a505080b
commit 103ae043ea

View file

@ -165,7 +165,7 @@ void save_vbnv_flash(const uint8_t *vbnv_copy)
}
}
if (rdev_writeat(rdev, vbnv_copy, new_offset, BLOB_SIZE) < 0) {
if (rdev_writeat(rdev, vbnv_copy, new_offset, BLOB_SIZE) == BLOB_SIZE) {
/* write was successful. safely move pointer forward */
ctx->blob_offset = new_offset;
memcpy(ctx->cache, vbnv_copy, BLOB_SIZE);