[coreboot-gerrit] New patch to review for coreboot: drivers/intel/fsp2_0: fix hand-off-block types and size
Aaron Durbin (adurbin@chromium.org)
gerrit at coreboot.org
Mon Jul 18 19:48:36 CEST 2016
Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15737
-gerrit
commit 75a8a40e65588221f3cb9f082e60d219e7240e37
Author: Aaron Durbin <adurbin at chromium.org>
Date: Sat Jul 16 17:29:47 2016 -0500
drivers/intel/fsp2_0: fix hand-off-block types and size
The gcc compiler treats sizeof(void) == 1. Therefore requesting
a 1 byte reservation in cbmem and writing a pointer into the
buffer returned is wrong. Fix the size of the request to be
32-bits because FSP 2.0 is in 32-bt space by definition. Also,
since the access to the field happens across stage boundaries
it's important to ensure fixed widths are used in case a later
stage has a different pointer bit width.
BUG=chrome-os-partner:52679
Change-Id: Ib4efc7d5369d44a995318aac6c4a7cfdc73e4a8c
Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
src/drivers/intel/fsp2_0/hand_off_block.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c
index 00c5d26..c9d5b8e 100644
--- a/src/drivers/intel/fsp2_0/hand_off_block.c
+++ b/src/drivers/intel/fsp2_0/hand_off_block.c
@@ -184,16 +184,16 @@ struct hob_resource *hob_header_to_resource(const struct hob_header *hob)
void fsp_save_hob_list(void *hob_list_ptr)
{
- void **cbmem_loc;
- cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*hob_list_ptr));
- *cbmem_loc = hob_list_ptr;
+ uint32_t *cbmem_loc;
+ cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc));
+ *cbmem_loc = (uintptr_t)hob_list_ptr;
}
const void *fsp_get_hob_list(void)
{
- void **list_loc = cbmem_find(CBMEM_ID_FSP_RUNTIME);
+ uint32_t *list_loc = cbmem_find(CBMEM_ID_FSP_RUNTIME);
- return (list_loc) ? (*list_loc) : NULL;
+ return (list_loc) ? (void *)(uintptr_t)(*list_loc) : NULL;
}
static const
More information about the coreboot-gerrit
mailing list