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

Ard Biesheuvel posted 1 patch 2 weeks, 5 days ago
Failed in applying to current master (apply log)
EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

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

Posted by Ard Biesheuvel 2 weeks, 5 days ago
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@arm.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 (#69807): https://edk2.groups.io/g/devel/message/69807
Mute This Topic: https://groups.io/mt/79472089/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


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

Posted by Leif Lindholm 2 weeks, 4 days ago
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@arm.com>

Reviewed-by: Leif Lindholm <leif@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/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


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

Posted by Ard Biesheuvel 2 weeks, 3 days ago
On 1/7/21 6:44 PM, Leif Lindholm wrote:
> 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@arm.com>
> 
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
> 

Thanks. Merged as #1322

>> ---
>>  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 (#70041): https://edk2.groups.io/g/devel/message/70041
Mute This Topic: https://groups.io/mt/79472089/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-