From: Laszlo Ersek Date: Thu, 6 Aug 2015 10:13:33 +0000 (+0000) Subject: OvmfPkg: PlatformDebugLibIoPort: fix AsciiSPrint() format string X-Git-Tag: edk2-stable201903~9112 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3d8ac52a5d8df67555dc1bdba42d09c682cd71a9;hp=8f227c2fd97c8160c6e3f99c532d778942efaf62;p=mirror_edk2.git OvmfPkg: PlatformDebugLibIoPort: fix AsciiSPrint() format string The LineNumber parameter of the DebugAssert() function has type UINTN. DebugAssert() passes it to AsciiSPrint() with the %d conversion specifier at the moment, but %d would require an INT32 argument. Fix this by casting LineNumber to UINT64, also employing the matching decimal conversion specifier, %Lu. (Another possibility would be to cast LineNumber to INT32, but a UINTN->INT32 cast is not value preserving, generally speaking.) Cc: Jordan Justen Cc: Scott Duplichan Reported-by: Scott Duplichan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18173 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c index 585f9fb111..44850a9dba 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c @@ -134,7 +134,8 @@ DebugAssert ( // // Generate the ASSERT() message in Ascii format // - AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description); + AsciiSPrint (Buffer, sizeof Buffer, "ASSERT %a(%Lu): %a\n", FileName, + (UINT64)LineNumber, Description); // // Send the print string to the Console Output device