From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.73021.1682404853065588212 for ; Mon, 24 Apr 2023 23:40:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OR7UcYTA; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: pen-chunx.lu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682404853; x=1713940853; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=AQeSsUAxXoDZRl7i96WXwsijPidQHaHtkPEZVr7tQDg=; b=OR7UcYTAjoTnYRiVWen/Sp6yLqp0rd5OF4oo9fkMrelLZKRWyNJlZ6Eq OEPtOopUV7KLJjwh85mKObJzKcLslrn/TcpJxGTNWauEnYFMKaNGa5pSI 9JasjGilNOi8Vb9N2Y3uzrhDK4IrBrtvdYiE8nW9JYL3+/+ZBkSBl81u/ KVtL6NvcbvzMdCFWAOZzQbYVMIpv1L6GY2028Jj2oHz1Dcn4ElUoT/HSe 71wOHYU8Dx3LbMHzd/w3p2WDWYKoDevbkxq5sJ8VwoiD3CWIcoy1jnDoR vGnTCgvU2ykZo9rZbeUvtY//AZTMt2ss7VF2/cUi9kqSa7veLl2FZCJ3Y Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="409615629" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="409615629" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 23:40:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10690"; a="1023016820" X-IronPort-AV: E=Sophos;i="5.99,224,1677571200"; d="scan'208";a="1023016820" Received: from shserverbios518.ccr.corp.intel.com ([10.5.215.124]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 23:40:50 -0700 From: "JoeX Lu" To: devel@edk2.groups.io Cc: JoeX Lu , Jian J Wang , Liming Gao , Dandan Bi , Eric Dong , Jiewen Yao Subject: [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr] Date: Tue, 25 Apr 2023 14:40:27 +0800 Message-Id: <20230425064027.18117-1-pen-chunx.lu@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Jian J Wang Cc: Liming Gao Cc: Dandan Bi Cc: Eric Dong Cc: devel@edk2.groups.io Cc: Jiewen Yao Signed-off-by: JoeX Lu --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 20 ++++++++++++------- .../HashLibBaseCryptoRouterPei.c | 19 ++++++++++++++---- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index 63a37ab59a..a024d3b8d2 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -3415,25 +3415,31 @@ HiiCreateGuidOpCode ( IN UINTN OpCodeSize ) { - EFI_IFR_GUID OpCode; + EFI_IFR_GUID *OpCode; EFI_IFR_GUID *OpCodePointer; ASSERT (Guid != NULL); ASSERT (OpCodeSize >= sizeof (OpCode)); - ZeroMem (&OpCode, sizeof (OpCode)); - CopyGuid ((EFI_GUID *)(VOID *)&OpCode.Guid, Guid); + OpCode = (EFI_IFR_GUID *) AllocateZeroPool (sizeof (EFI_IFR_GUID)); + if (OpCode == NULL) { + return NULL; + } + CopyGuid ((EFI_GUID *)(VOID *)&OpCode->Guid, Guid); OpCodePointer = (EFI_IFR_GUID *)InternalHiiCreateOpCodeExtended ( OpCodeHandle, - &OpCode, + OpCode, EFI_IFR_GUID_OP, - sizeof (OpCode), - OpCodeSize - sizeof (OpCode), + sizeof (EFI_IFR_GUID), + OpCodeSize - sizeof (EFI_IFR_GUID), 0 ); if ((OpCodePointer != NULL) && (GuidOpCode != NULL)) { - CopyMem (OpCodePointer + 1, (EFI_IFR_GUID *)GuidOpCode + 1, OpCodeSize - sizeof (OpCode)); + CopyMem (OpCodePointer + 1, (EFI_IFR_GUID *)GuidOpCode + 1, OpCodeSize - sizeof (EFI_IFR_GUID)); + } + if (OpCode != NULL) { + FreePool (OpCode); } return (UINT8 *)OpCodePointer; diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c index eeb424b6c3..c8052fed15 100644 --- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c +++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c @@ -84,11 +84,22 @@ InternalCreateHashInterfaceHob ( EFI_GUID *Identifier ) { - HASH_INTERFACE_HOB LocalHashInterfaceHob; + HASH_INTERFACE_HOB *LocalHashInterfaceHob; + HASH_INTERFACE_HOB *HobBuffer; - ZeroMem (&LocalHashInterfaceHob, sizeof (LocalHashInterfaceHob)); - CopyGuid (&LocalHashInterfaceHob.Identifier, Identifier); - return BuildGuidDataHob (&mHashLibPeiRouterGuid, &LocalHashInterfaceHob, sizeof (LocalHashInterfaceHob)); + HobBuffer = NULL; + LocalHashInterfaceHob = AllocateZeroPool (sizeof (HASH_INTERFACE_HOB)); + if (LocalHashInterfaceHob == NULL) { + return NULL; + } + + CopyGuid (&LocalHashInterfaceHob->Identifier, Identifier); + HobBuffer = (HASH_INTERFACE_HOB *) BuildGuidDataHob (&mHashLibPeiRouterGuid, &LocalHashInterfaceHob, sizeof (LocalHashInterfaceHob)); + + if (LocalHashInterfaceHob != NULL) { + FreePool (LocalHashInterfaceHob); + } + return HobBuffer; } /** -- 2.31.1.windows.1