From 5c98152c58a6a493f1ac7f2275f2e72df456f6df Mon Sep 17 00:00:00 2001 From: vit9696 Date: Fri, 1 Feb 2019 19:45:39 +0300 Subject: [PATCH] Fix analyzer warnings --- common/ffsparser.cpp | 14 +++++--------- common/ffsparser.h | 2 +- common/nvramparser.cpp | 2 ++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index 7351fe5..72ab610 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -3419,9 +3419,7 @@ USTATUS FfsParser::parseFit(const UModelIndex & index) // Search for FIT UModelIndex fitIndex; UINT32 fitOffset; - USTATUS result = findFitRecursive(index, fitIndex, fitOffset); - if (result) - return result; + findFitRecursive(index, fitIndex, fitOffset); // FIT not found if (!fitIndex.isValid()) @@ -3569,18 +3567,18 @@ USTATUS FfsParser::parseFit(const UModelIndex & index) 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 if (!index.isValid()) { - return U_SUCCESS; + return; } // Process child items for (int i = 0; i < model->rowCount(index); i++) { findFitRecursive(index.child(i, 0), found, fitOffset); if (found.isValid()) - return U_SUCCESS; + return; } // Check for all FIT signatures in item's body @@ -3597,13 +3595,11 @@ USTATUS FfsParser::findFitRecursive(const UModelIndex & index, UModelIndex & fou found = index; fitOffset = offset; 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 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) diff --git a/common/ffsparser.h b/common/ffsparser.h index 32bdeb2..0ab735a 100644 --- a/common/ffsparser.h +++ b/common/ffsparser.h @@ -149,7 +149,7 @@ private: USTATUS parseIntelMicrocodeHeader(const UByteArray & store, const UINT32 localOffset, const UModelIndex & parent, UModelIndex & index); #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 USTATUS parseFitEntryMicrocode(const UByteArray & microcode, const UINT32 localOffset, const UModelIndex & parent, UString & info, UINT32 &realSize); diff --git a/common/nvramparser.cpp b/common/nvramparser.cpp index 498d1f2..63e92c4 100644 --- a/common/nvramparser.cpp +++ b/common/nvramparser.cpp @@ -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 const INTEL_MICROCODE_HEADER* ucodeHeader = (const INTEL_MICROCODE_HEADER*)signature; storeSize = ucodeHeader->TotalSize; + } else { + return U_INVALID_PARAMETER; // Unreachable } return U_SUCCESS; }