[edk2-devel] [PATCH] FmpDevicePkg/FmpDxe: Fix uninitialized pointer dereference

Michael D Kinney michael.d.kinney at intel.com
Wed Mar 18 15:15:12 UTC 2020


Reviewed-by: Michael D Kinney <michael.d.kinney at intel.com>

> -----Original Message-----
> From: Xu, Wei6 <wei6.xu at intel.com>
> Sent: Tuesday, March 17, 2020 11:12 PM
> To: devel at edk2.groups.io
> Cc: Kun Qin <kuqin at microsoft.com>; Kinney, Michael D
> <michael.d.kinney at intel.com>; Gao, Liming
> <liming.gao at intel.com>
> Subject: [edk2-devel] [PATCH] FmpDevicePkg/FmpDxe: Fix
> uninitialized pointer dereference
> 
> From: Kun Qin <kuqin at microsoft.com>
> 
> REF:
> https://bugzilla.tianocore.org/show_bug.cgi?id=2602
> 
> Zero the allocated buffer in case GetImageInfo
> `continue` in the middle of
> a loop. This will cause unexpected GetImageInfo failure
> not clearing the
> corresponding entry and lead to GP faults when
> dereferencing this entry.
> 
> Cc: Michael D Kinney <michael.d.kinney at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Signed-off-by: Wei6 Xu <wei6.xu at intel.com>
> ---
>  FmpDevicePkg/FmpDxe/Dependency.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/FmpDevicePkg/FmpDxe/Dependency.c
> b/FmpDevicePkg/FmpDxe/Dependency.c
> index 8f97c42916..65c23989c6 100644
> --- a/FmpDevicePkg/FmpDxe/Dependency.c
> +++ b/FmpDevicePkg/FmpDxe/Dependency.c
> @@ -550,11 +550,11 @@ EvaluateImageDependencies (
>                  );
>    if (EFI_ERROR (Status)) {
>      return EFI_ABORTED;
>    }
> 
> -  mFmpImageInfoBuf = AllocatePool
> (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) *
> mNumberOfFmpInstance);
> +  mFmpImageInfoBuf = AllocateZeroPool
> (sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR *) *
> mNumberOfFmpInstance);
>    if (mFmpImageInfoBuf == NULL) {
>      return EFI_OUT_OF_RESOURCES;
>    }
> 
>    for (Index = 0; Index < mNumberOfFmpInstance; Index
> ++) {
> --
> 2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#55957): https://edk2.groups.io/g/devel/message/55957
Mute This Topic: https://groups.io/mt/72043533/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