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 6B46E7803D9 for ; Thu, 14 Mar 2024 02:03:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=7cGK48vMuR2DZuA00Td4SWvOUNWkkm+k7lyAjBetTAo=; 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=1710381827; v=1; b=vCrsMGjZcoCmQgxnkiIrFcdMIyGHkLHPCKiFIk0Q6XY9M4FgZ4srYwEwoXmhiYkcpKI1tIGE FBZ75QqzRCvOTeRpl+jlf8xLMf0yBnTbAsoHqftDVa0yhthnG9uqtm0Ok7eQA6xmcijZjfIcnbU XaX/4r1YteQpTJLXJt8ti79j9uwnNDQS/+Zs1LkwjExUIp49Q3eFY//1KBslUKUn9IsulSShKeS URGazq8M2BUlWJkGBtZcrjqn7JA7FlyWjWmHEvKHVQ9NvTNpcR2fLxXfHgHek0JWA/CUNJKdruS pY7+N4sZEaYpzmfvHmVEemHg6wkqF3mlifCIp4p3oB/xQ== X-Received: by 127.0.0.2 with SMTP id 1ZaXYY7687511xyI4d3Th1sj; Wed, 13 Mar 2024 19:03:47 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mx.groups.io with SMTP id smtpd.web11.1814.1710381827178728497 for ; Wed, 13 Mar 2024 19:03:47 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,11012"; a="9002076" X-IronPort-AV: E=Sophos;i="6.07,124,1708416000"; d="scan'208";a="9002076" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 19:03:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,124,1708416000"; d="scan'208";a="43170101" X-Received: from sh1gapp1006.ccr.corp.intel.com ([10.239.189.76]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 19:02:19 -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 v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit() Date: Thu, 14 Mar 2024 10:02:06 +0800 Message-ID: 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: Wed, 13 Mar 2024 19:03:47 -0700 Reply-To: devel@edk2.groups.io,du.lin@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 1Ox11eo4wcyWseNem7fyZGdJx7686176AA= 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=vCrsMGjZ; 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 --- IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index ba0c742fea..7f1deb9542 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -197,12 +197,20 @@ FspmWrapperInit ( MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { + 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) { + 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 (#116723): https://edk2.groups.io/g/devel/message/116723 Mute This Topic: https://groups.io/mt/104919472/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-