diff options
author | Joel Kitching <kitching@google.com> | 2019-07-25 16:39:56 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-16 07:25:30 +0000 |
commit | eb10ebf76d78a7ac7cb6b66c6f1bba747d4e10ca (patch) | |
tree | 31e71507502a3a233fae0fd5fbbbe2fadd494659 /tests/vb2_misc_tests.c | |
parent | 445e371ebc7afaca6be293f43055eae0fbeb67be (diff) | |
download | vboot-eb10ebf76d78a7ac7cb6b66c6f1bba747d4e10ca.tar.gz |
vboot: vb2_shared_data offsets should hang off parentstabilize-12428.B
vb2_shared_data struct has many offsets to other objects in the
workbuf. They are all prefixed with `workbuf_`, e.g.:
uint32_t workbuf_data_key_offset;
uint32_t workbuf_data_key_size;
In order to adhere to a hierarchical structure on the workbuf,
remove the workbuf_ prefix from these symbols to reflect the
relationship between vb2_shared_data and its children more
accurately.
Create a helper function vb2_member_of to safely look up a child
of a particular object in the workbuf by offset. Pointer
arithmetic to find vb2_shared_data children is replaced with
calls to this function.
BUG=b:124141368, chromium:994060
TEST=make clean && make runtests
BRANCH=none
Change-Id: Ia82417a35d2067ee5e4f42fea0396e6325127223
Signed-off-by: Joel Kitching <kitching@google.com>
Cq-Depend: chromium:1753400
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1718264
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'tests/vb2_misc_tests.c')
-rw-r--r-- | tests/vb2_misc_tests.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/vb2_misc_tests.c b/tests/vb2_misc_tests.c index a9f82531..c2763e4e 100644 --- a/tests/vb2_misc_tests.c +++ b/tests/vb2_misc_tests.c @@ -228,8 +228,7 @@ static void gbb_tests(void) TEST_SUCC(vb2_fw_parse_gbb(&ctx), "parse gbb"); /* Manually calculate the location of GBB since we have mocked out the original definition of vb2_get_gbb. */ - struct vb2_gbb_header *current_gbb = - (struct vb2_gbb_header *)((void *)sd + sd->gbb_offset); + struct vb2_gbb_header *current_gbb = vb2_member_of(sd, sd->gbb_offset); TEST_SUCC(memcmp(&gbbsrc, current_gbb, sizeof(gbbsrc)), "copy gbb contents"); TEST_EQ(used_before, ctx.workbuf_used - sizeof(gbbsrc), |