Re: [edk2] [PATCH] OvmfPkg: PlatformDebugLibIoPort: fix AsciiSPrint() format string
On 08/05/15 18:32, Laszlo Ersek wrote: 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.jus...@intel.com Cc: Scott Duplichan sc...@notabs.org Reported-by: Scott Duplichan sc...@notabs.org Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek ler...@redhat.com --- OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c index 88f9e55..e1ff103 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 Committed to SVN as rev 18173. ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] OvmfPkg: PlatformDebugLibIoPort: fix AsciiSPrint() format string
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com On 2015-08-05 09:32:17, Laszlo Ersek wrote: 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.jus...@intel.com Cc: Scott Duplichan sc...@notabs.org Reported-by: Scott Duplichan sc...@notabs.org Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek ler...@redhat.com --- OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c index 88f9e55..e1ff103 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 -- 1.8.3.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel