summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/errlentry.C
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2018-09-24 23:57:36 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-09-28 08:44:43 -0500
commit17bf8a65e3be9ea06eab4ec8a6553246cdc9c6a2 (patch)
treec601cd1cd9583b6823e68fcbb243fe973b840742 /src/usr/errl/errlentry.C
parente30bf32f696010969d242d95531f494deb4e8150 (diff)
downloadtalos-hostboot-17bf8a65e3be9ea06eab4ec8a6553246cdc9c6a2.tar.gz
talos-hostboot-17bf8a65e3be9ea06eab4ec8a6553246cdc9c6a2.zip
Fix duplicate trace section removal accounting in error log flatten
Prior to this change, if trace sections were removed in order to jettison duplicate trace entries, the error log's section count could be miscomputed, causing the unflatten API to detect corrupt error log content. This change tracks the actual number of sections flattened into the log, and updates the final section count in the private header accordingly. Change-Id: Id63582b6c73e3344bdc80a7fcb277526d806201f CQ: SW446517 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66547 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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/errl/errlentry.C')
-rw-r--r--src/usr/errl/errlentry.C18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C
index 850d8d7ec..b1715ad41 100644
--- a/src/usr/errl/errlentry.C
+++ b/src/usr/errl/errlentry.C
@@ -1623,7 +1623,8 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
// Inform the private header how many sections there are,
// counting the PH, UH, PS, and the optionals.
- iv_Private.iv_sctns = 3 + iv_SectionVector.size();
+ const auto startingSectionCount = iv_SectionVector.size();
+ iv_Private.iv_sctns = 3 + startingSectionCount;
// Flatten the PH private header section
char * pBuffer = static_cast<char *>(o_pBuffer);
@@ -1679,7 +1680,7 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
//
// for saving errorlogs into PNOR, i_truncate will be set to true
// and sections which don't fit are not saved.
- uint32_t l_sectionCount = iv_SectionVector.size();
+ size_t flattenedSections = 0;
std::vector<ErrlUD*>::const_iterator it;
for(it = iv_SectionVector.begin();
@@ -1698,8 +1699,6 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
// TODO: RTC 77560 - error if this happens during test
TRACFCOMP( g_trac_errl,
INFO_MRK"ud.flatten error, skipping");
- // won't fit - don't count it.
- l_sectionCount--;
continue;
}
else
@@ -1710,6 +1709,7 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
break;
}
}
+ ++flattenedSections;
pBuffer += l_cb;
l_sizeRemaining -= l_cb;
}
@@ -1733,8 +1733,6 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
// TODO: RTC 77560 - error if this happens during test
TRACFCOMP( g_trac_errl,
INFO_MRK"ud.flatten error, skipping");
- // won't fit - don't count it.
- l_sectionCount--;
continue;
}
else
@@ -1745,6 +1743,7 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
break;
}
}
+ ++flattenedSections;
pBuffer += l_cb;
l_sizeRemaining -= l_cb;
}
@@ -1771,8 +1770,6 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
// TODO: RTC 77560 - error if this happens during test
TRACFCOMP( g_trac_errl,
INFO_MRK"ud.flatten error, skipping");
- // won't fit - don't count it.
- l_sectionCount--;
continue;
}
else
@@ -1783,6 +1780,7 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
break;
}
}
+ ++flattenedSections;
pBuffer += l_cb;
l_sizeRemaining -= l_cb;
}
@@ -1793,12 +1791,12 @@ uint64_t ErrlEntry::flatten( void * o_pBuffer,
break;
}
- if (l_sectionCount != iv_SectionVector.size())
+ if (flattenedSections != startingSectionCount)
{
// some section was too big and didn't get flatten - update the
// section count in the PH section and re-flatten it.
// count is the PH, UH, PS, and the optionals.
- iv_Private.iv_sctns = 3 + l_sectionCount;
+ iv_Private.iv_sctns = 3 + flattenedSections;
// use ph size, since this is overwriting flattened data
l_cb = iv_Private.flatten( pPHBuffer, iv_Private.flatSize() );
if( 0 == l_cb )
OpenPOWER on IntegriCloud