public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string
@ 2023-03-27  8:02 Gerd Hoffmann
  2023-03-27  9:31 ` Laszlo Ersek
  2023-03-27 10:42 ` Ni, Ray
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2023-03-27  8:02 UTC (permalink / raw)
  To: devel
  Cc: Gerd Hoffmann, Eric Dong, Rahul Kumar, Oliver Steffen,
	Pawel Polawski, Ray Ni, Laszlo Ersek

BufferPages is UINTN, so we need "%Lu" when printing it to avoid
it being truncated.  Also cast to UINT64 to make sure it works
for 32bit builds too.

Fixes: 4f441d024bee ("UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling")
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
index cf69161caa4b..c0e368ea9475 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
@@ -880,7 +880,7 @@ PiCpuSmmEntry (
     BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1));
     Buffer      = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
     if (Buffer == NULL) {
-      DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages));
+      DEBUG ((DEBUG_ERROR, "Failed to allocate %Lu pages.\n", (UINT64)BufferPages));
       CpuDeadLoop ();
       return EFI_OUT_OF_RESOURCES;
     }
-- 
2.39.2


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

* Re: [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string
  2023-03-27  8:02 [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string Gerd Hoffmann
@ 2023-03-27  9:31 ` Laszlo Ersek
  2023-03-27 10:42 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2023-03-27  9:31 UTC (permalink / raw)
  To: Gerd Hoffmann, devel
  Cc: Eric Dong, Rahul Kumar, Oliver Steffen, Pawel Polawski, Ray Ni

On 3/27/23 10:02, Gerd Hoffmann wrote:
> BufferPages is UINTN, so we need "%Lu" when printing it to avoid
> it being truncated.  Also cast to UINT64 to make sure it works
> for 32bit builds too.
> 
> Fixes: 4f441d024bee ("UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling")
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> index cf69161caa4b..c0e368ea9475 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> @@ -880,7 +880,7 @@ PiCpuSmmEntry (
>      BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1));
>      Buffer      = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
>      if (Buffer == NULL) {
> -      DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages));
> +      DEBUG ((DEBUG_ERROR, "Failed to allocate %Lu pages.\n", (UINT64)BufferPages));
>        CpuDeadLoop ();
>        return EFI_OUT_OF_RESOURCES;
>      }

Reviewed-by: Laszlo Ersek <lersek@redhat.com>


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

* Re: [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string
  2023-03-27  8:02 [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string Gerd Hoffmann
  2023-03-27  9:31 ` Laszlo Ersek
@ 2023-03-27 10:42 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2023-03-27 10:42 UTC (permalink / raw)
  To: Gerd Hoffmann, devel@edk2.groups.io
  Cc: Dong, Eric, Kumar, Rahul R, Oliver Steffen, Pawel Polawski,
	Laszlo Ersek

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Gerd Hoffmann <kraxel@redhat.com>
> Sent: Monday, March 27, 2023 4:02 PM
> To: devel@edk2.groups.io
> Cc: Gerd Hoffmann <kraxel@redhat.com>; Dong, Eric <eric.dong@intel.com>;
> Kumar, Rahul R <rahul.r.kumar@intel.com>; Oliver Steffen
> <osteffen@redhat.com>; Pawel Polawski <ppolawsk@redhat.com>; Ni, Ray
> <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string
> 
> BufferPages is UINTN, so we need "%Lu" when printing it to avoid
> it being truncated.  Also cast to UINT64 to make sure it works
> for 32bit builds too.
> 
> Fixes: 4f441d024bee ("UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling")
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> index cf69161caa4b..c0e368ea9475 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
> @@ -880,7 +880,7 @@ PiCpuSmmEntry (
>      BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize *
> (mMaxNumberOfCpus - 1));
>      Buffer      = AllocateAlignedCodePages (BufferPages, SIZE_4KB);
>      if (Buffer == NULL) {
> -      DEBUG ((DEBUG_ERROR, "Failed to allocate %d pages.\n", BufferPages));
> +      DEBUG ((DEBUG_ERROR, "Failed to allocate %Lu pages.\n",
> (UINT64)BufferPages));
>        CpuDeadLoop ();
>        return EFI_OUT_OF_RESOURCES;
>      }
> --
> 2.39.2


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

end of thread, other threads:[~2023-03-27 10:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27  8:02 [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string Gerd Hoffmann
2023-03-27  9:31 ` Laszlo Ersek
2023-03-27 10:42 ` Ni, Ray

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