public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN
@ 2022-01-29  8:30 Guomin Jiang
  2022-02-01 22:39 ` Guo Dong
  2022-02-01 22:58 ` Ma, Maurice
  0 siblings, 2 replies; 3+ messages in thread
From: Guomin Jiang @ 2022-01-29  8:30 UTC (permalink / raw)
  To: devel; +Cc: Guo Dong, Ray Ni, Maurice Ma, Benjamin You

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.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN
  2022-01-29  8:30 [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN Guomin Jiang
@ 2022-02-01 22:39 ` Guo Dong
  2022-02-01 22:58 ` Ma, Maurice
  1 sibling, 0 replies; 3+ messages in thread
From: Guo Dong @ 2022-02-01 22:39 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io; +Cc: Ni, Ray, Ma, Maurice, You, Benjamin


Reviewed-by: Guo Dong <guo.dong@intel.com>

-----Original Message-----
From: Jiang, Guomin <guomin.jiang@intel.com> 
Sent: Saturday, January 29, 2022 1:31 AM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@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.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN
  2022-01-29  8:30 [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN Guomin Jiang
  2022-02-01 22:39 ` Guo Dong
@ 2022-02-01 22:58 ` Ma, Maurice
  1 sibling, 0 replies; 3+ messages in thread
From: Ma, Maurice @ 2022-02-01 22:58 UTC (permalink / raw)
  To: Jiang, Guomin, devel@edk2.groups.io; +Cc: Dong, Guo, Ni, Ray, You, Benjamin

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.jiang@intel.com>
> Sent: Saturday, January 29, 2022 0:31
> To: devel@edk2.groups.io
> Cc: Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma,
> Maurice <maurice.ma@intel.com>; You, Benjamin
> <benjamin.you@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.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Signed-off-by: Guomin Jiang <guomin.jiang@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-01 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-29  8:30 [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN Guomin Jiang
2022-02-01 22:39 ` Guo Dong
2022-02-01 22:58 ` Ma, Maurice

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox