[edk2-devel] [PATCH v1 1/1] IntelSiliconPkg/ShadowMicrocodePei: Fix return value in ShadowMicrocode.
Ni, Ray
ray.ni at intel.com
Wed Dec 9 06:25:42 UTC 2020
OK. I saw the code that calls FreePool(). So no memory leak issue.
(though FreePool is a nop in PEI)
Can you improve the change a bit by merging the two FreePool (PatchInfoBuffer) together?
Thanks,
Ray
> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Ni, Ray
> Sent: Wednesday, December 9, 2020 2:19 PM
> To: devel at edk2.groups.io; Li, Aaron <aaron.li at intel.com>
> Cc: Chaganty, Rangasai V <rangasai.v.chaganty at intel.com>; Fu, Siyuan
> <siyuan.fu at intel.com>
> Subject: Re: [edk2-devel] [PATCH v1 1/1] IntelSiliconPkg/ShadowMicrocodePei:
> Fix return value in ShadowMicrocode.
>
> It seems PatchInfoBuffer is not freed when Not Found is returned.
>
> Thanks,
> Ray
>
> > -----Original Message-----
> > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Aaron Li
> > Sent: Tuesday, December 8, 2020 2:19 PM
> > To: devel at edk2.groups.io
> > Cc: Ni, Ray <ray.ni at intel.com>; Chaganty, Rangasai V
> > <rangasai.v.chaganty at intel.com>; Fu, Siyuan <siyuan.fu at intel.com>
> > Subject: [edk2-devel] [PATCH v1 1/1] IntelSiliconPkg/ShadowMicrocodePei:
> Fix
> > return value in ShadowMicrocode.
> >
> > ShadowMicrocode should return EFI_NOT_FOUND when no valid Microcode
> > found
> > in FIT table.
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3110
> >
> > Signed-off-by: Aaron Li <aaron.li at intel.com>
> > Cc: Ray Ni <ray.ni at intel.com>
> > Cc: Rangasai V Chaganty <rangasai.v.chaganty at intel.com>
> > Cc: Siyuan Fu <siyuan.fu at intel.com>
> > ---
> >
> >
> Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei.c
> > | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git
> >
> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei
> > .c
> >
> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei
> > .c
> > index 5c7ee6910c8e..5539a121cbb6 100644
> > ---
> >
> a/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei
> > .c
> > +++
> >
> b/Silicon/Intel/IntelSiliconPkg/Feature/ShadowMicrocode/ShadowMicrocodePei
> > .c
> > @@ -377,6 +377,9 @@ IsValidFitTable (
> > with microcode patches data in it.
> >
> >
> >
> > @retval EFI_SUCCESS The microcode has been shadowed to
> memory.
> >
> > + @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL.
> >
> > + @retval EFI_INVALID_PARAMETER CpuIdCount not equal to 0 and
> > MicrocodeCpuId is NULL.
> >
> > + @retval EFI_NOT_FOUND No valid microcode found.
> >
> > @retval EFI_OUT_OF_RESOURCES The operation fails due to lack of
> > resources.
> >
> >
> >
> > **/
> >
> > @@ -460,6 +463,9 @@ ShadowMicrocode (
> > ));
> >
> >
> >
> > ShadowMicrocodePatchWorker (PatchInfoBuffer, PatchCount,
> TotalLoadSize,
> > BufferSize, Buffer);
> >
> > + } else {
> >
> > + FreePool (PatchInfoBuffer);
> >
> > + return EFI_NOT_FOUND;
> >
> > }
> >
> >
> >
> > FreePool (PatchInfoBuffer);
> >
> > --
> > 2.29.2.windows.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#68443): https://edk2.groups.io/g/devel/message/68443
> > Mute This Topic: https://groups.io/mt/78798288/1712937
> > Group Owner: devel+owner at edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni at intel.com]
> > -=-=-=-=-=-=
> >
>
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68491): https://edk2.groups.io/g/devel/message/68491
Mute This Topic: https://groups.io/mt/78798288/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list