Gerd, "%d" tells "int" type value is in the stack. This actually works in both 32bit and 64bit case assuming the BufferPages is less than MAX_UINT32.
But if using "%Lu", it tells that "uint_64" type value is in the stack. This precisely describes the stack content in 64bit mode. But it may print random value in the stack as high-32 bit in 32bit mode. @Kinney, Michael D, any comments? Thanks, Ray > -----Original Message----- > From: Gerd Hoffmann <kra...@redhat.com> > Sent: Friday, March 24, 2023 9:42 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.d...@intel.com>; Gerd Hoffmann <kra...@redhat.com>; > Oliver Steffen <ostef...@redhat.com>; Kumar, Rahul R > <rahul.r.ku...@intel.com>; Ni, Ray <ray...@intel.com>; Pawel Polawski > <ppola...@redhat.com>; Laszlo Ersek <ler...@redhat.com> > Subject: [PATCH 1/1] UefiCpuPkg/PiSmmCpuDxeSmm: fix format string > > BufferPages is UINTN, so we need "%Lu" when printing it. > > Fixes: 4f441d024bee ("UefiCpuPkg/PiSmmCpuDxeSmm: fix error handling") > Reported-by: Laszlo Ersek <ler...@redhat.com> > Signed-off-by: Gerd Hoffmann <kra...@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..08663b1b1ab4 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", > BufferPages)); > CpuDeadLoop (); > return EFI_OUT_OF_RESOURCES; > } > -- > 2.39.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101784): https://edk2.groups.io/g/devel/message/101784 Mute This Topic: https://groups.io/mt/97823585/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-