Marshall Dawson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35349 )
Change subject: drivers/intel/fsp2_0: Allocate cfg_region_size for UPD ......................................................................
drivers/intel/fsp2_0: Allocate cfg_region_size for UPD
In FSP-S, the driver constructs its pointer to UPD using the offset in the header. The cfg_region_size should likewise be used for allocating memory and copying the default configuration. Make the change and add an error message in case there are more UPD definitions than cfg_region_size.
TEST=Verify OK on Mandolin, verify a mock error condition BUG=b:140648081
Change-Id: I20fad0e27a2ad537898b6d01e5241e1508da690c Signed-off-by: Marshall Dawson marshalldawson3rd@gmail.com --- M src/drivers/intel/fsp2_0/silicon_init.c 1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/35349/1
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c index e72e4ac..6a899bf 100644 --- a/src/drivers/intel/fsp2_0/silicon_init.c +++ b/src/drivers/intel/fsp2_0/silicon_init.c @@ -39,9 +39,11 @@ die_with_post_code(POST_INVALID_VENDOR_BINARY, "Invalid FSPS signature\n");
- upd = xmalloc(sizeof(FSPS_UPD)); + upd = xmalloc(hdr->cfg_region_size);
- memcpy(upd, supd, sizeof(FSPS_UPD)); + memcpy(upd, supd, hdr->cfg_region_size); + if (hdr->image_size < sizeof(FSPS_UPD)) + printk(BIOS_ERR, "FSP error: more UPD specified than allowed by header cfg_region_size\n");
/* Give SoC/mainboard a chance to populate entries */ platform_fsp_silicon_init_params_cb(upd);