security/vboot: Remove buffer_size from struct vboot_working_data

Since buffer_size is no longer used, remove it from struct
vboot_working_data.

BRANCH=none
BUG=chromium:1021452
TEST=emerge-kukui coreboot

Change-Id: Ie770e89b4a45e0ec703d5bbb8fb6a298ce915056
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36844
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yu-Ping Wu 2019-11-14 11:38:44 +08:00 committed by Patrick Georgi
parent a0e1e596f8
commit ea544574d0
3 changed files with 11 additions and 13 deletions

View File

@ -227,7 +227,14 @@ static void lb_vboot_workbuf(struct lb_header *header)
vbwb->tag = LB_TAG_VBOOT_WORKBUF; vbwb->tag = LB_TAG_VBOOT_WORKBUF;
vbwb->size = sizeof(*vbwb); vbwb->size = sizeof(*vbwb);
vbwb->range_start = (uintptr_t)wd + wd->buffer_offset; vbwb->range_start = (uintptr_t)wd + wd->buffer_offset;
vbwb->range_size = wd->buffer_size; /*
* TODO(chromium:1021452): Since cbmem size of vboot workbuf is now
* always a known value, we hardcode the value of range_size here.
* Ultimately we'll want to move this to add_cbmem_pointers() below,
* but we'll have to get rid of the vboot_working_data struct first.
*/
vbwb->range_size = VB2_KERNEL_WORKBUF_RECOMMENDED_SIZE -
wd->buffer_offset;
} }
__weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; } __weak uint32_t board_id(void) { return UNDEFINED_STRAPPING_ID; }

View File

@ -73,11 +73,11 @@ struct vb2_context *vboot_get_context(void)
*/ */
memset(wd, 0, sizeof(*wd)); memset(wd, 0, sizeof(*wd));
wd->buffer_offset = ALIGN_UP(sizeof(*wd), 16); wd->buffer_offset = ALIGN_UP(sizeof(*wd), 16);
wd->buffer_size = VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE
- wd->buffer_offset;
/* Initialize vb2_shared_data and friends. */ /* Initialize vb2_shared_data and friends. */
assert(vb2api_init(vboot_get_workbuf(wd), wd->buffer_size, assert(vb2api_init(vboot_get_workbuf(wd),
VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE -
wd->buffer_offset,
vboot_ctx_ptr) == VB2_SUCCESS); vboot_ctx_ptr) == VB2_SUCCESS);
return *vboot_ctx_ptr; return *vboot_ctx_ptr;
@ -137,14 +137,6 @@ static void vboot_migrate_cbmem(int unused)
cbmem_add(CBMEM_ID_VBOOT_WORKBUF, cbmem_size); cbmem_add(CBMEM_ID_VBOOT_WORKBUF, cbmem_size);
assert(wd_cbmem != NULL); assert(wd_cbmem != NULL);
memcpy(wd_cbmem, wd_preram, sizeof(struct vboot_working_data)); memcpy(wd_cbmem, wd_preram, sizeof(struct vboot_working_data));
/*
* TODO(chromium:1021452): buffer_size is uint16_t and not large enough
* to hold the kernel verification workbuf size. The only code which
* reads this value is in lb_vboot_workbuf() for lb_range->range_size.
* This value being zero doesn't cause any problems, since it is never
* read downstream. Fix or deprecate vboot_working_data.
*/
wd_cbmem->buffer_size = 0;
vb2api_relocate(vboot_get_workbuf(wd_cbmem), vb2api_relocate(vboot_get_workbuf(wd_cbmem),
vboot_get_workbuf(wd_preram), vboot_get_workbuf(wd_preram),
cbmem_size - wd_cbmem->buffer_offset, cbmem_size - wd_cbmem->buffer_offset,

View File

@ -39,7 +39,6 @@ struct vboot_working_data {
struct selected_region selected_region; struct selected_region selected_region;
/* offset of the buffer from the start of this struct */ /* offset of the buffer from the start of this struct */
uint16_t buffer_offset; uint16_t buffer_offset;
uint16_t buffer_size;
}; };
/* /*