]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: PlatformDebugLibIoPort: fix AsciiSPrint() format string
authorLaszlo Ersek <lersek@redhat.com>
Thu, 6 Aug 2015 10:13:33 +0000 (10:13 +0000)
committerlersek <lersek@Edk2>
Thu, 6 Aug 2015 10:13:33 +0000 (10:13 +0000)
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 <jordan.l.justen@intel.com>
Cc: Scott Duplichan <scott@notabs.org>
Reported-by: Scott Duplichan <scott@notabs.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18173 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c

index 585f9fb111d70195c488043d8d18a4fe7ec959c1..44850a9dbad06117840a703666930f949fdb847a 100644 (file)
@@ -134,7 +134,8 @@ DebugAssert (
   //\r
   // Generate the ASSERT() message in Ascii format\r
   //\r
-  AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description);\r
+  AsciiSPrint (Buffer, sizeof Buffer, "ASSERT %a(%Lu): %a\n", FileName,\r
+    (UINT64)LineNumber, Description);\r
 \r
   //\r
   // Send the print string to the Console Output device\r