summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/errlentry.C
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2017-11-16 13:20:23 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-11-20 15:35:23 -0500
commitdfdf4bee880f30dd5aefa3cfba70801ad78c760b (patch)
treed5187037b199a8a5afa0df53a9f1a548452c0425 /src/usr/errl/errlentry.C
parentc037b71deb05442aa4365b69aeed63d16db8fb31 (diff)
downloadtalos-hostboot-dfdf4bee880f30dd5aefa3cfba70801ad78c760b.tar.gz
talos-hostboot-dfdf4bee880f30dd5aefa3cfba70801ad78c760b.zip
Remove invalid access to TARGETING::EntityPath in base image
The addPartCallout path was triggering a call to the EntityPath constructor which leads to an Inst Exception. I saw the same issue in the other callout paths so fixed those too. Change-Id: I348e09d4f19d50edb39aea9093fa3d5701a0be39 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/49840 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> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/errl/errlentry.C')
-rw-r--r--src/usr/errl/errlentry.C140
1 files changed, 69 insertions, 71 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C
index bfeadb9b8..e613ffb56 100644
--- a/src/usr/errl/errlentry.C
+++ b/src/usr/errl/errlentry.C
@@ -278,34 +278,56 @@ void ErrlEntry::removeBackTrace()
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
-void ErrlEntry::addClockCallout(const TARGETING::Target *i_target,
- const HWAS::clockTypeEnum i_clockType,
- const HWAS::callOutPriority i_priority,
- const HWAS::DeconfigEnum i_deconfigState,
- const HWAS::GARD_ErrorType i_gardErrorType)
+/*
+ * @brief Safely retrieves the EntityPath for the target or the SENTINEL
+ * pointer if appropriate
+ * @param[in] i_target Target to evaluate
+ * @param[out] o_ePath Pointer to new EntityPath if applicable, if this
+ * comes back non-NULL, caller must delete the memory
+ * @param[out] o_dataPtr Pointer to target data
+ * @param[out] o_dataSize Size of target data
+ */
+void getTargData( const TARGETING::Target *i_target,
+ TARGETING::EntityPath*& o_ePath,
+ const void*& o_dataPtr,
+ uint32_t& o_dataSize )
{
- TRACFCOMP(g_trac_errl, ENTER_MRK"addClockCallout(%p, %d, 0x%x)",
- i_target, i_clockType, i_priority);
-
- TARGETING::EntityPath ep;
- const void *pData;
- uint32_t size;
-
+ o_ePath = nullptr;
+ o_dataPtr = nullptr;
+ o_dataSize = 0;
if (i_target == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
{
- size = sizeof(HWAS::TARGET_IS_SENTINEL);
- pData = &HWAS::TARGET_IS_SENTINEL;
+ o_dataSize = sizeof(HWAS::TARGET_IS_SENTINEL);
+ o_dataPtr = &HWAS::TARGET_IS_SENTINEL;
}
else
{ // we got a non MASTER_SENTINEL target, therefore the targeting
// module is loaded, therefore we can make this call.
- ep = i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ o_ePath = new TARGETING::EntityPath;
+ *o_ePath = i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
// size is total EntityPath size minus unused path elements
- size = sizeof(ep) -
- (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep.size()) *
- sizeof(TARGETING::EntityPath::PathElement);
- pData = &ep;
+ o_dataSize = sizeof(*o_ePath) -
+ (TARGETING::EntityPath::MAX_PATH_ELEMENTS - o_ePath->size()) *
+ sizeof(TARGETING::EntityPath::PathElement);
+ o_dataPtr = o_ePath;
}
+}
+
+////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////
+void ErrlEntry::addClockCallout(const TARGETING::Target *i_target,
+ const HWAS::clockTypeEnum i_clockType,
+ const HWAS::callOutPriority i_priority,
+ const HWAS::DeconfigEnum i_deconfigState,
+ const HWAS::GARD_ErrorType i_gardErrorType)
+{
+ TRACFCOMP(g_trac_errl, ENTER_MRK"addClockCallout(%p, %d, 0x%x)",
+ i_target, i_clockType, i_priority);
+
+ const void* pData = nullptr;
+ uint32_t size = 0;
+ TARGETING::EntityPath* ep = nullptr;
+ getTargData( i_target, ep, pData, size );
ErrlUserDetailsCallout( pData, size, i_clockType,
i_priority, i_deconfigState, i_gardErrorType).addToLog(this);
@@ -319,6 +341,10 @@ void ErrlEntry::addClockCallout(const TARGETING::Target *i_target,
setDeconfigBit();
}
+ if( ep )
+ {
+ delete ep;
+ }
} // addClockCallout
@@ -343,25 +369,10 @@ void ErrlEntry::addPartCallout(const TARGETING::Target *i_target,
TRACFCOMP(g_trac_errl, ENTER_MRK"addPartCallout(%p, %d, 0x%x)",
i_target, i_partType, i_priority);
- TARGETING::EntityPath ep;
- const void *pData;
- uint32_t size;
-
- if (i_target == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
- {
- size = sizeof(HWAS::TARGET_IS_SENTINEL);
- pData = &HWAS::TARGET_IS_SENTINEL;
- }
- else
- { // we got a non MASTER_SENTINEL target, therefore the targeting
- // module is loaded, therefore we can make this call.
- ep = i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // size is total EntityPath size minus unused path elements
- size = sizeof(ep) -
- (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep.size()) *
- sizeof(TARGETING::EntityPath::PathElement);
- pData = &ep;
- }
+ const void* pData = nullptr;
+ uint32_t size = 0;
+ TARGETING::EntityPath* ep = nullptr;
+ getTargData( i_target, ep, pData, size );
ErrlUserDetailsCallout( pData, size, i_partType,
i_priority, i_deconfigState, i_gardErrorType).addToLog(this);
@@ -375,6 +386,10 @@ void ErrlEntry::addPartCallout(const TARGETING::Target *i_target,
setDeconfigBit();
}
+ if( ep )
+ {
+ delete ep;
+ }
} // addPartCallout
////////////////////////////////////////////////////////////////////////////
@@ -387,45 +402,28 @@ void ErrlEntry::addBusCallout(const TARGETING::Target *i_target_endp1,
TRACFCOMP(g_trac_errl, ENTER_MRK"addBusCallout(%p, %p, %d, 0x%x)",
i_target_endp1, i_target_endp2, i_busType, i_priority);
- TARGETING::EntityPath ep1, ep2;
- const void *pData1, *pData2;
- uint32_t size1, size2;
+ const void* pData1 = nullptr;
+ uint32_t size1 = 0;
+ TARGETING::EntityPath* ep1 = nullptr;
+ getTargData( i_target_endp1, ep1, pData1, size1 );
- if (i_target_endp1 == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
- {
- size1 = sizeof(HWAS::TARGET_IS_SENTINEL);
- pData1 = &HWAS::TARGET_IS_SENTINEL;
- }
- else
- { // we got a non MASTER_SENTINEL target, therefore the targeting
- // module is loaded, therefore we can make this call.
- ep1 = i_target_endp1->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // size is total EntityPath size minus unused path elements
- size1 = sizeof(ep1) -
- (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep1.size()) *
- sizeof(TARGETING::EntityPath::PathElement);
- pData1 = &ep1;
- }
+ const void* pData2 = nullptr;
+ uint32_t size2 = 0;
+ TARGETING::EntityPath* ep2 = nullptr;
+ getTargData( i_target_endp2, ep2, pData2, size2 );
- if (i_target_endp2 == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL)
- {
- size2 = sizeof(HWAS::TARGET_IS_SENTINEL);
- pData2 = &HWAS::TARGET_IS_SENTINEL;
- }
- else
- { // we got a non MASTER_SENTINEL target, therefore the targeting
- // module is loaded, therefore we can make this call.
- ep2 = i_target_endp2->getAttr<TARGETING::ATTR_PHYS_PATH>();
- // size is total EntityPath size minus unused path elements
- size2 = sizeof(ep2) -
- (TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep2.size()) *
- sizeof(TARGETING::EntityPath::PathElement);
- pData2 = &ep2;
- }
ErrlUserDetailsCallout( pData1, size1, pData2, size2, i_busType,
i_priority).addToLog(this);
+ if( ep1 )
+ {
+ delete ep1;
+ }
+ if( ep2 )
+ {
+ delete ep2;
+ }
} // addBusCallout
OpenPOWER on IntegriCloud