[edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]

JoeX Lu posted 1 patch 1 year ago
Failed in applying to current master (apply log)
MdeModulePkg/Library/UefiHiiLib/HiiLib.c      | 20 ++++++++++++-------
.../HashLibBaseCryptoRouterPei.c              | 19 ++++++++++++++----
2 files changed, 28 insertions(+), 11 deletions(-)
[edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]
Posted by JoeX Lu 1 year ago
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: devel@edk2.groups.io
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
---
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103667): https://edk2.groups.io/g/devel/message/103667
Mute This Topic: https://groups.io/mt/98524246/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
回复: [edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]
Posted by gaoliming via groups.io 1 year ago
Pen:
  How do you find this warning message?

  And, please separate the patch for the different packages. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 JoeX Lu
> 发送时间: 2023年4月25日 14:40
> 收件人: devel@edk2.groups.io
> 抄送: JoeX Lu <pen-chunx.lu@intel.com>; Jian J Wang
> <jian.j.wang@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Dandan
> Bi <dandan.bi@intel.com>; Eric Dong <eric.dong@intel.com>; Jiewen Yao
> <jiewen.yao@intel.com>
> 主题: [edk2-devel] [PATCH] Fix GCC5 Release build warning
> [-Wreturn-local-addr]
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: devel@edk2.groups.io
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
> ---
>  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/HashLibBaseCryptoRouterP
> ei.c
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> index eeb424b6c3..c8052fed15 100644
> ---
> a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> +++
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.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
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103683): https://edk2.groups.io/g/devel/message/103683
Mute This Topic: https://groups.io/mt/98529493/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]
Posted by JoeX Lu 1 year ago
Hi Liming,
  A1: Just compiler with GCC5 in Linux and search Wreturn-local-addr in Build log
  A2: Thanks for your comment, I will resend the patches after separating the patch for different patches.

Best Regards,
Joe Lu

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Thursday, April 27, 2023 10:25 AM
To: devel@edk2.groups.io; Lu, Pen-ChunX <pen-chunx.lu@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: 回复: [edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]

Pen:
  How do you find this warning message?

  And, please separate the patch for the different packages. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 JoeX Lu
> 发送时间: 2023年4月25日 14:40
> 收件人: devel@edk2.groups.io
> 抄送: JoeX Lu <pen-chunx.lu@intel.com>; Jian J Wang 
> <jian.j.wang@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Dandan 
> Bi <dandan.bi@intel.com>; Eric Dong <eric.dong@intel.com>; Jiewen Yao 
> <jiewen.yao@intel.com>
> 主题: [edk2-devel] [PATCH] Fix GCC5 Release build warning 
> [-Wreturn-local-addr]
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: devel@edk2.groups.io
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
> ---
>  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/HashLibBaseCryptoRouterP
> ei.c
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> index eeb424b6c3..c8052fed15 100644
> ---
> a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> +++
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.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
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103686): https://edk2.groups.io/g/devel/message/103686
Mute This Topic: https://groups.io/mt/98529733/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]
Posted by JoeX Lu 1 year ago
Hi Liming,
  A1: Just execute "python3.8 BirchStreamRpPkg/PlatformBIOSBuild.py -b RELEASE -t GCC5" in Linux and search Wreturn-local-addr in Build log
  A2: Thanks for your comment, I will resend the patches after separating the patch for different patches.

Best Regards,
Joe Lu

-----Original Message-----
From: gaoliming <gaoliming@byosoft.com.cn> 
Sent: Thursday, April 27, 2023 10:25 AM
To: devel@edk2.groups.io; Lu, Pen-ChunX <pen-chunx.lu@intel.com>
Cc: Wang, Jian J <jian.j.wang@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Dong, Eric <eric.dong@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: 回复: [edk2-devel] [PATCH] Fix GCC5 Release build warning [-Wreturn-local-addr]

Pen:
  How do you find this warning message?

  And, please separate the patch for the different packages. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 JoeX Lu
> 发送时间: 2023年4月25日 14:40
> 收件人: devel@edk2.groups.io
> 抄送: JoeX Lu <pen-chunx.lu@intel.com>; Jian J Wang 
> <jian.j.wang@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Dandan 
> Bi <dandan.bi@intel.com>; Eric Dong <eric.dong@intel.com>; Jiewen Yao 
> <jiewen.yao@intel.com>
> 主题: [edk2-devel] [PATCH] Fix GCC5 Release build warning 
> [-Wreturn-local-addr]
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Dandan Bi <dandan.bi@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: devel@edk2.groups.io
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
> ---
>  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/HashLibBaseCryptoRouterP
> ei.c
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> index eeb424b6c3..c8052fed15 100644
> ---
> a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.c
> +++
> b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterP
> ei.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
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#103684): https://edk2.groups.io/g/devel/message/103684
Mute This Topic: https://groups.io/mt/98529577/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-