diff options
author | Prachi Gupta <pragupta@us.ibm.com> | 2018-08-10 13:57:48 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-08-15 13:01:47 -0500 |
commit | c818c28e735f6e036e25007ee09f0e5a1b08b452 (patch) | |
tree | 8ed55709d55268070c213ae31157bc77afaf102e /src/usr | |
parent | c66059fce342d2a9d5a984b1136c14f74fc51db6 (diff) | |
download | talos-hostboot-c818c28e735f6e036e25007ee09f0e5a1b08b452.tar.gz talos-hostboot-c818c28e735f6e036e25007ee09f0e5a1b08b452.zip |
WOF Lid load: Remove extra malloc and use getStoredLidImage
Currently, both hbrt and phyp are calling malloc when loading
WOF lids. This causes heap overflow when the heap is super
fragmented. So, a quick way to avoid heap overflow is to
remove malloc from HBRT. Additionally, we want to use getStoredLidImage
because it will return the cached copy of the lid if it exists.
Change-Id: I9bf6e8ec7c94d97a1998a56482f617608835d635
CQ:SW441541
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64270
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Richard Ward <rward15@us.ibm.com>
Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/fapi2/plat_wof_access.C | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/usr/fapi2/plat_wof_access.C b/src/usr/fapi2/plat_wof_access.C index 24c17b8aa..f4a6313c8 100644 --- a/src/usr/fapi2/plat_wof_access.C +++ b/src/usr/fapi2/plat_wof_access.C @@ -256,9 +256,15 @@ fapi2::ReturnCode platParseWOFTables(uint8_t* o_wofData) FAPI_INF("WOFDATA lid is %d bytes", l_lidImageSize); #ifdef __HOSTBOOT_RUNTIME - // Locally allocate space for the lid - l_pWofImage = static_cast<void*>(malloc(l_lidImageSize)); + // In HBRT case, phyp will call malloc and return + // the lid pointer to us. We do not need to malloc + // the space ourselves. In fact, two mallocs + // on the WOF partition were leading to heap overflows. + l_pWofImage = nullptr; + // Using getStoredLidImage because we want to use the cached copies + // if they exist. + l_errl = l_wofLidMgr.getStoredLidImage(l_pWofImage, l_lidImageSize); #else // Use a special VMM block to avoid the requirement for // contiguous memory @@ -328,11 +334,10 @@ fapi2::ReturnCode platParseWOFTables(uint8_t* o_wofData) // Point my local pointer at the VMM space we allocated l_pWofImage = g_wofdataVMM; -#endif - - // Get the tables from pnor or lid l_errl = l_wofLidMgr.getLid(l_pWofImage, l_lidImageSize); +#endif + if(l_errl) { FAPI_ERR("platParseWOFTables getLid failed " |