From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 06D657803DB for ; Tue, 12 Mar 2024 15:40:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9iwFOpLKEmgcnt61o3z0loK9oafz6yIvnFdQYfdMF9M=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710258012; v=1; b=ipJyUfMtAwnIU2p9wgJ1La590dlki0qDxUOYoJ2wE0DVWEM3vPUnJYX9ElYYZG/0h3J1vdrB dnUVe7StVqLkzTbla0dFFhT456cRWGz4D0NdyXt4sMM43mQQp0uxuTeS9+UMK70jVcotmgdkC/x uHWC1r2D5r2shEHUD91IrClz9VdfsRuOKi9/yj43yGy7IFOcImO5bz8YqVI7K9/M17xiE/tLmYD RJj7Omr+h8VtRqhFqtzL4f8ex+gPvf3kNZePQeL/hIaFQF7moL24KAAc3boehLyxoCpBKcZHw/l EnrCHkX+4MjZjWcJFBZo0X9EVIEdLgBJRyILJXJbDC1jg== X-Received: by 127.0.0.2 with SMTP id NwdIYY7687511xb1fSeMvdHR; Tue, 12 Mar 2024 08:40:12 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by mx.groups.io with SMTP id smtpd.web11.4505.1710235709430405836 for ; Tue, 12 Mar 2024 02:28:29 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5067771" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5067771" X-Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 02:28:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="15967405" X-Received: from sh1gapp1006.ccr.corp.intel.com ([10.239.189.76]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 02:28:26 -0700 From: "Du Lin" To: devel@edk2.groups.io Cc: Du Lin , Ashraf Ali S , Chasel Chiu , Chen Gang C , Duggapu Chinni B , Nate DeSimone , Star Zeng , Susovan Mohapatra , Ted Kuo Subject: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit() Date: Tue, 12 Mar 2024 17:27:42 +0800 Message-ID: <15718c1dd224a860cbf24f9d1d5d8e4afd14ff85.1710235504.git.du.lin@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 12 Mar 2024 08:40:05 -0700 Reply-To: devel@edk2.groups.io,du.lin@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SKSUH6PHsDvfqmARv4IRcxqcx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=ipJyUfMt; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701 The error handling of FspmWrapperInit() is limited to ASSERT statements only, which only works in debug builds, but not in release builds. Fix the issue by enhancing the error handling of FspmWrapperInit() to cover both debug builds and release builds. Signed-off-by: Du Lin Cc: Ashraf Ali S Cc: Chasel Chiu Cc: Chen Gang C Cc: Duggapu Chinni B Cc: Nate DeSimone Cc: Star Zeng Cc: Susovan Mohapatra Cc: Ted Kuo --- .../FspmWrapperPeim/FspmWrapperPeim.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index ba0c742fea..356baeeccf 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -196,13 +196,21 @@ FspmWrapperInit ( EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList; MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); - ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { + ASSERT (FALSE); + return EFI_OUT_OF_RESOURCES; + } + MeasurementExcludedFvPpi->Count = 1; MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspmBaseAddress); MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength; MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList)); - ASSERT (MeasurementExcludedPpiList != NULL); + if (MeasurementExcludedPpiList == NULL) { + ASSERT (FALSE); + return EFI_OUT_OF_RESOURCES; + } + MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid; MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi; -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116686): https://edk2.groups.io/g/devel/message/116686 Mute This Topic: https://groups.io/mt/104886876/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-