From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.6057.1609928999893048183 for ; Wed, 06 Jan 2021 02:30:00 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C0B2F1FB; Wed, 6 Jan 2021 02:29:58 -0800 (PST) Received: from e123331-lin.nice.arm.com (unknown [10.37.8.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C8B993F719; Wed, 6 Jan 2021 02:29:57 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: gaoliming@byosoft.com.cn, leif@nuviainc.com, Ard Biesheuvel Subject: [PATCH] EmbeddedPkg/PrePiMemoryAllocationLib: use correct size for pool hob Date: Wed, 6 Jan 2021 11:29:25 +0100 Message-Id: <20210106102925.9808-1-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 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 --- 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