[edk2-devel] [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: use correct size for pool hob

Leif Lindholm leif at nuviainc.com
Thu Jan 7 17:44:02 UTC 2021


On Wed, Jan 06, 2021 at 11:29:25 +0100, Ard Biesheuvel wrote:
> Use the correct type in the sizeof() expression to calculate the size
> of the newly allocated EFI_HOB_MEMORY_POOL hob.
> 
> Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3139
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at arm.com>

Reviewed-by: Leif Lindholm <leif at nuviainc.com>

> ---
>  EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> index 6d233acb98d7..bae6682c72b6 100644
> --- a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> +++ b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c
> @@ -184,7 +184,9 @@ AllocatePool (
>      return 0;
>    } else {
>  
> -    Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL, (UINT16)(sizeof (EFI_HOB_TYPE_MEMORY_POOL) + AllocationSize));
> +    Hob = (EFI_HOB_MEMORY_POOL *)CreateHob (EFI_HOB_TYPE_MEMORY_POOL,
> +                                   (UINT16)(sizeof (EFI_HOB_MEMORY_POOL) +
> +                                            AllocationSize));
>      return (VOID *)(Hob + 1);
>    }
>  }
> -- 
> 2.17.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69944): https://edk2.groups.io/g/devel/message/69944
Mute This Topic: https://groups.io/mt/79472089/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