summaryrefslogtreecommitdiffstats
path: root/src/usr/vpd/ipvpd.C
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2014-11-06 13:08:24 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-01-30 09:40:11 -0600
commit7452530902bcc31b361748d832c0f44fe277b686 (patch)
treed56db7ac0183c03ea288c4517016dcc04c0c28ab /src/usr/vpd/ipvpd.C
parente7dd491766237e728331d51064ddf7382c23c404 (diff)
downloadtalos-hostboot-7452530902bcc31b361748d832c0f44fe277b686.tar.gz
talos-hostboot-7452530902bcc31b361748d832c0f44fe277b686.zip
Fix issue with overwriting PNOR VPD cache
Planar VPD needs more space for each CVPD record than CDIMMs need. Also added a check to catch overruns. Change-Id: I6aa2291658388cc72b6ba1e04c3eeed51235c3e3 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14382 Tested-by: Jenkins Server Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/vpd/ipvpd.C')
-rw-r--r--src/usr/vpd/ipvpd.C31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C
index 2eec10f4f..229a50d27 100644
--- a/src/usr/vpd/ipvpd.C
+++ b/src/usr/vpd/ipvpd.C
@@ -65,7 +65,6 @@ extern trace_desc_t* g_trac_vpd;
static const uint64_t IPVPD_TOC_SIZE = 0x100; //256
static const uint64_t IPVPD_TOC_ENTRY_SIZE = 8;
static const uint64_t IPVPD_TOC_INVALID_DATA = 0xFFFFFFFFFFFFFFFF;
-static const uint32_t IPVPD_MAX_ENTRY_SIZE = (64 * 1024);
/**
@@ -433,7 +432,7 @@ errlHndl_t IpVpdFacade::loadPnor ( TARGETING::Target * i_target )
}
// Temp data for entire VPD entry
- uint8_t* tmpVpdPtr = new uint8_t[IPVPD_MAX_ENTRY_SIZE];
+ uint8_t* tmpVpdPtr = new uint8_t[iv_vpdSectionSize];
// Load the temp data with invalid TOC
uint64_t tocdata = IPVPD_TOC_INVALID_DATA;
@@ -500,6 +499,34 @@ errlHndl_t IpVpdFacade::loadPnor ( TARGETING::Target * i_target )
&pTocEntry,
IPVPD_TOC_ENTRY_SIZE );
+ // Make sure we don't exceed our allocated space in PNOR
+ if( (pRecOffset + sRecLength) > iv_vpdSectionSize )
+ {
+ TRACFCOMP(g_trac_vpd,"IpVpdFacade::loadPnor()> The amount of space required (0x%X) for the VPD cache exceeds the available space (0x%X)", pRecOffset + sRecLength, iv_vpdSectionSize );
+ /*@
+ * @errortype
+ * @reasoncode VPD::VPD_CACHE_SIZE_EXCEEDED
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid VPD::VPD_IPVPD_LOAD_PNOR
+ * @userdata1 HUID of target chip
+ * @userdata2[00:31] Available size
+ * @userdata2[32:63] Requested size
+ * @devdesc The amount of space required for the VPD
+ * cache exceeds the available space
+ * @custdesc Fatal firmware boot error
+ */
+ err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ VPD::VPD_IPVPD_LOAD_PNOR,
+ VPD::VPD_CACHE_SIZE_EXCEEDED,
+ TARGETING::get_huid(i_target),
+ TWO_UINT32_TO_UINT64(
+ iv_vpdSectionSize,
+ pRecOffset + sRecLength ),
+ true /*Add HB SW Callout*/ );
+ err->collectTrace( "VPD", 256 );
+ break;
+ }
+
// Read record data from SEEPROM, put it into temp data
uint8_t* pRecPtr = tmpVpdPtr + pRecOffset;
err = fetchData( sRecOffset,
OpenPOWER on IntegriCloud