Shouldn't "Delta" be INTN type ?  It can be either positive or negative, right ?

For the case you explained below,  I think the caller should pass in INTN type 
instead of UINTN.  
So maybe a better fix is to change  "UINTN    Delta" to "INTN   Delta" in the 
caller function RelocateElf64Sections() inside file 
UefiPayloadPkg\PayloadLoaderPeim\ElfLib\Elf64Lib.c.

Thanks
Maurice

> -----Original Message-----
> From: Jiang, Guomin <guomin.ji...@intel.com>
> Sent: Saturday, January 29, 2022 0:31
> To: devel@edk2.groups.io
> Cc: Dong, Guo <guo.d...@intel.com>; Ni, Ray <ray...@intel.com>; Ma,
> Maurice <maurice...@intel.com>; You, Benjamin
> <benjamin....@intel.com>
> Subject: [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta
> type INTN with UINTN
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3818
> 
> ProcessRelocation64 use INTN  Delta. However it force it to UINTN when call
> it.
> 
> It will have some potential issue when memory larger than 2G because the
> high memory address will be fill with 0xFFFFFFFF if use INTN.
> 
> Cc: Guo Dong <guo.d...@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Cc: Maurice Ma <maurice...@intel.com>
> Cc: Benjamin You <benjamin....@intel.com>
> Signed-off-by: Guomin Jiang <guomin.ji...@intel.com>
> ---
>  UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> index dc47a05c6e4a..ee530322d7ed 100644
> --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> @@ -108,7 +108,7 @@ ProcessRelocation64 (
>    IN  UINT64      RelaSize,
>    IN  UINT64      RelaEntrySize,
>    IN  UINT64      RelaType,
> -  IN  INTN        Delta,
> +  IN  UINTN       Delta,
>    IN  BOOLEAN     DynamicLinking
>    )
>  {
> --
> 2.30.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86325): https://edk2.groups.io/g/devel/message/86325
Mute This Topic: https://groups.io/mt/88763343/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to