diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-09-09 17:47:21 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-10 20:03:26 +0000 |
commit | 176e01ded3bcefb6cb8baa984a158d42562bb1e9 (patch) | |
tree | fe038ca26e3111a1d65554f6b8a5417440aa9f36 /scripts | |
parent | 3dd8fe4c4e927fdb14a7a943911f6f118c56bc0a (diff) | |
download | vboot-176e01ded3bcefb6cb8baa984a158d42562bb1e9.tar.gz |
crossystem: allow last nvdata entry to be filled
Mosys used to have code (below), which led me to believe that we
always try and leave the last entry unfilled:
memset(blank, 0xff, VBNV_BLOCK_SIZE);
for (index = 0; index < len / VBNV_BLOCK_SIZE; index++) {
unsigned int offset = index * VBNV_BLOCK_SIZE;
if (!memcmp(blank, &data[offset], VBNV_BLOCK_SIZE))
break;
}
if (index == 0) {
lprintf(LOG_ERR, "VBNV is uninitialized\n");
return -1;
} else if (index >= len) { <---- SEE NOTE
lprintf(LOG_ERR, "VBNV is full\n"); <--- unreachable
return -1;
} else {
return index - 1;
}
The statement at "SEE NOTE" will always be false, so this code fooled
me to believe that we consider VBNV without a row of 0xFF*16 to be
empty.
And so I implemented and wrote unit tests for what I believed the
correct behavior to be :/
Anyway, this is causing us issues since AP firmware does not implement
it that way. So allow the last row to be filled.
BUG=chromium:1112578
BRANCH=none
TEST=unit tests
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: Ib3da78eddef69a688d081cdb5391a25000dac9d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2402385
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions