public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Release build in GCC5 has warning message Wreturn-local-addr in HashPeiLib
@ 2023-04-27  6:58 JoeX Lu
  2023-04-27  7:50 ` Yao, Jiewen
  0 siblings, 1 reply; 6+ messages in thread
From: JoeX Lu @ 2023-04-27  6:58 UTC (permalink / raw)
  To: devel; +Cc: JoeX Lu, Jiewen Yao, Jian J Wang

CC: Jiewen Yao <jiewen.yao@intel.com>
CC: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
---
 .../HashLibBaseCryptoRouterPei.c                | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c
index eeb424b6c3..bf7a5fc65c 100644
--- a/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c
+++ b/SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.c
@@ -84,11 +84,20 @@ 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-27  9:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27  6:58 [PATCH] Release build in GCC5 has warning message Wreturn-local-addr in HashPeiLib JoeX Lu
2023-04-27  7:50 ` Yao, Jiewen
2023-04-27  7:58   ` JoeX Lu
2023-04-27  8:21     ` Yao, Jiewen
2023-04-27  8:55       ` JoeX Lu
2023-04-27  9:10         ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox