summaryrefslogtreecommitdiff
path: root/tests/vb2_misc_tests.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2018-01-03 15:34:03 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-05 21:14:12 -0800
commit1a5e02c7a9ca66fb20f6752225903aa7a4dd0f70 (patch)
tree00f79930ba040eb8e660b04a88553cd68108fc75 /tests/vb2_misc_tests.c
parentde818cc08fab92ad389dc92f31687f3314a1a03a (diff)
downloadvboot-1a5e02c7a9ca66fb20f6752225903aa7a4dd0f70.tar.gz
firmware: Align workbuf used size
Previously, workbuf used was not rounded up to a multiple of VB2_WORKBUF_ALIGN. The next allocation would be aligned, but not until it was made. Change this to round up used size when more workbuf is used. This provides better predictability of where the next allocation will be placed. Uncovered this problem when I added a new member to vb2_shared_data which changed its size so it wasn't a multiple of VB2_WORKBUF_ALIGN, and the vb20 and vb21 unit tests which tried to simulate not enough buffer broke in strange ways. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I0157a1c96326f7fce6be6efbd74d90c3d2942268 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852488 Reviewed-by: Shelley Chen <shchen@chromium.org>
Diffstat (limited to 'tests/vb2_misc_tests.c')
-rw-r--r--tests/vb2_misc_tests.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/vb2_misc_tests.c b/tests/vb2_misc_tests.c
index aa3b061f..01131b49 100644
--- a/tests/vb2_misc_tests.c
+++ b/tests/vb2_misc_tests.c
@@ -86,7 +86,7 @@ static void init_context_tests(void)
reset_common_data();
TEST_SUCC(vb2_init_context(&c), "Init context good");
- TEST_EQ(c.workbuf_used, sizeof(struct vb2_shared_data),
+ TEST_EQ(c.workbuf_used, vb2_wb_round_up(sizeof(struct vb2_shared_data)),
"Init vbsd");
/* Don't re-init if used is non-zero */