From 3a32bbd54815b9a6a09da2349fb56c8aad98341a Mon Sep 17 00:00:00 2001 From: Zane Shelley Date: Mon, 1 May 2017 11:30:26 -0500 Subject: PRD: Fixed parsing bug in MEM_CE_TABLE Iterating one too many times if extra unused data at the end of the buffer. Change-Id: Ic3f8027f5734e7222ce63729c91c4b26a83deab5 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39888 Tested-by: Jenkins Server Reviewed-by: Caleb N. Palmer Reviewed-by: Benjamin J. Weisenbeck Reviewed-by: Brian J. Stegmiller Reviewed-by: Zane C. Shelley Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39968 Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins --- src/usr/diag/prdf/common/plugins/prdfMemLogParse.C | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/usr/diag/prdf/common/plugins/prdfMemLogParse.C b/src/usr/diag/prdf/common/plugins/prdfMemLogParse.C index 0b7e4f17f..d39751f56 100644 --- a/src/usr/diag/prdf/common/plugins/prdfMemLogParse.C +++ b/src/usr/diag/prdf/common/plugins/prdfMemLogParse.C @@ -3072,10 +3072,10 @@ bool parseMemCeTable( uint8_t * i_buffer, uint32_t i_buflen, i_parser.PrintNumber( " MEM_CE_TABLE", "%d", entries ); - const char * hh = " A H Count RC"; + const char * hh = " A H Count RC"; const char * hd = "Rank P Bank Row Column DRAM Pins S E Site"; i_parser.PrintString( hh, hd ); - hh = " - - ----- ----"; + hh = " - - ----- ----"; hd = "---- - ---- ------- ------ ---- ---- - - ------"; i_parser.PrintString( hh, hd ); @@ -3087,8 +3087,9 @@ bool parseMemCeTable( uint8_t * i_buffer, uint32_t i_buflen, // Bytes 2-7 are currently unused. // Get the entry info. - for ( uint32_t idx = METADATA_SIZE; idx < i_buflen; - idx += CE_TABLE::ENTRY_SIZE ) + for ( uint32_t idx = METADATA_SIZE, entry = 0; + idx < i_buflen && entry < entries; + idx += CE_TABLE::ENTRY_SIZE, entry++ ) { uint32_t count = i_buffer[idx ]; // 8-bit // 5 spare bits // 5-bit @@ -3157,7 +3158,7 @@ bool parseMemCeTable( uint8_t * i_buffer, uint32_t i_buflen, // Build the header string. char header[HEADER_SIZE] = { '\0' }; - snprintf( header, HEADER_SIZE, " %c %c %3d %s ", active_char, + snprintf( header, HEADER_SIZE, " %c %c %3d %s ", active_char, isHard_char, count, cardName_str ); // Build the data string. -- cgit v1.2.3