Fix analyzer warnings

This commit is contained in:
vit9696 2019-02-01 19:45:39 +03:00
parent f863caac9d
commit 5c98152c58
3 changed files with 8 additions and 10 deletions

View File

@ -3419,9 +3419,7 @@ USTATUS FfsParser::parseFit(const UModelIndex & index)
// Search for FIT // Search for FIT
UModelIndex fitIndex; UModelIndex fitIndex;
UINT32 fitOffset; UINT32 fitOffset;
USTATUS result = findFitRecursive(index, fitIndex, fitOffset); findFitRecursive(index, fitIndex, fitOffset);
if (result)
return result;
// FIT not found // FIT not found
if (!fitIndex.isValid()) if (!fitIndex.isValid())
@ -3569,18 +3567,18 @@ USTATUS FfsParser::parseFit(const UModelIndex & index)
return U_SUCCESS; return U_SUCCESS;
} }
USTATUS FfsParser::findFitRecursive(const UModelIndex & index, UModelIndex & found, UINT32 & fitOffset) void FfsParser::findFitRecursive(const UModelIndex & index, UModelIndex & found, UINT32 & fitOffset)
{ {
// Sanity check // Sanity check
if (!index.isValid()) { if (!index.isValid()) {
return U_SUCCESS; return;
} }
// Process child items // Process child items
for (int i = 0; i < model->rowCount(index); i++) { for (int i = 0; i < model->rowCount(index); i++) {
findFitRecursive(index.child(i, 0), found, fitOffset); findFitRecursive(index.child(i, 0), found, fitOffset);
if (found.isValid()) if (found.isValid())
return U_SUCCESS; return;
} }
// Check for all FIT signatures in item's body // Check for all FIT signatures in item's body
@ -3597,13 +3595,11 @@ USTATUS FfsParser::findFitRecursive(const UModelIndex & index, UModelIndex & fou
found = index; found = index;
fitOffset = offset; fitOffset = offset;
msg(usprintf("%s: real FIT table found at physical address %08Xh", __FUNCTION__, fitAddress), found); msg(usprintf("%s: real FIT table found at physical address %08Xh", __FUNCTION__, fitAddress), found);
return U_SUCCESS; break;
} }
else if (model->rowCount(index) == 0) // Show messages only to leaf items else if (model->rowCount(index) == 0) // Show messages only to leaf items
msg(usprintf("%s: FIT table candidate found, but not referenced from the last VTF", __FUNCTION__), index); msg(usprintf("%s: FIT table candidate found, but not referenced from the last VTF", __FUNCTION__), index);
} }
return U_SUCCESS;
} }
USTATUS FfsParser::parseFitEntryMicrocode(const UByteArray & microcode, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize) USTATUS FfsParser::parseFitEntryMicrocode(const UByteArray & microcode, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize)

View File

@ -149,7 +149,7 @@ private:
USTATUS parseIntelMicrocodeHeader(const UByteArray & store, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index); USTATUS parseIntelMicrocodeHeader(const UByteArray & store, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index);
#ifdef U_ENABLE_FIT_PARSING_SUPPORT #ifdef U_ENABLE_FIT_PARSING_SUPPORT
USTATUS findFitRecursive(const UModelIndex & index, UModelIndex & found, UINT32 & fitOffset); void findFitRecursive(const UModelIndex & index, UModelIndex & found, UINT32 & fitOffset);
// FIT entries // FIT entries
USTATUS parseFitEntryMicrocode(const UByteArray & microcode, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize); USTATUS parseFitEntryMicrocode(const UByteArray & microcode, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize);

View File

@ -761,6 +761,8 @@ USTATUS NvramParser::getStoreSize(const UByteArray & data, const UINT32 storeOff
else if (*signature == INTEL_MICROCODE_HEADER_VERSION) { // Intel microcode, must be checked after SLIC marker because of the same *signature values else if (*signature == INTEL_MICROCODE_HEADER_VERSION) { // Intel microcode, must be checked after SLIC marker because of the same *signature values
const INTEL_MICROCODE_HEADER* ucodeHeader = (const INTEL_MICROCODE_HEADER*)signature; const INTEL_MICROCODE_HEADER* ucodeHeader = (const INTEL_MICROCODE_HEADER*)signature;
storeSize = ucodeHeader->TotalSize; storeSize = ucodeHeader->TotalSize;
} else {
return U_INVALID_PARAMETER; // Unreachable
} }
return U_SUCCESS; return U_SUCCESS;
} }