From 2d1ebcc11b9af03fa7ba779ebef80517cb1a3f65 Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Sat, 18 Feb 2023 08:28:15 -0800 Subject: [PATCH] Fallback to RawArea parsing in case IntelDescriptor or Capsule parsing was unsuccesful --- common/ffsparser.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/common/ffsparser.cpp b/common/ffsparser.cpp index 95dd684..6701926 100644 --- a/common/ffsparser.cpp +++ b/common/ffsparser.cpp @@ -110,18 +110,14 @@ USTATUS FfsParser::performFirstPass(const UByteArray & buffer, UModelIndex & ind return U_INVALID_PARAMETER; } - USTATUS result; - // Try parsing as UEFI Capsule - result = parseCapsule(buffer, 0, UModelIndex(), index);; - if (result != U_ITEM_NOT_FOUND) { - return result; + if (U_SUCCESS == parseCapsule(buffer, 0, UModelIndex(), index)) { + return U_SUCCESS; } // Try parsing as Intel image - result = parseIntelImage(buffer, 0, UModelIndex(), index); - if (result != U_ITEM_NOT_FOUND) { - return result; + if (U_SUCCESS == parseIntelImage(buffer, 0, UModelIndex(), index)) { + return U_SUCCESS; } // Parse as generic image @@ -274,9 +270,8 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf UModelIndex imageIndex; // Try parsing as Intel image - USTATUS result = parseIntelImage(image, capsuleHeaderSize, index, imageIndex); - if (result != U_ITEM_NOT_FOUND) { - return result; + if (U_SUCCESS == parseIntelImage(image, capsuleHeaderSize, index, imageIndex)) { + return U_SUCCESS; } // Parse as generic image