* [PATCH] Release build in GCC5 has warning message Wreturn-local-addr in HiiLib
@ 2023-04-27 5:56 JoeX Lu
0 siblings, 0 replies; only message in thread
From: JoeX Lu @ 2023-04-27 5:56 UTC (permalink / raw)
To: devel; +Cc: JoeX Lu, Jian J Wang, Liming Gao, Dandan Bi, Eric Dong, devel
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
Signed-off-by: JoeX Lu <pen-chunx.lu@intel.com>
---
MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 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;
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-27 5:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27 5:56 [PATCH] Release build in GCC5 has warning message Wreturn-local-addr in HiiLib JoeX Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox