]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add ASSERT() conditions to UEFI Library Print() and AsciiPrint() functions if gST...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Jun 2010 19:11:20 +0000 (19:11 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 11 Jun 2010 19:11:20 +0000 (19:11 +0000)
Add ASSERT() conditions to UEFI Library ErrorPrint() and AsciiErrorPrint() functions if gST->StdErr is NULL.
Add ASSERT() conditions to UEFI Library PrintXY() and AsciiPrintXY() gST->ConsoleOutputHandle is NULL.
Update Print(), AsciiPrint(), ErrorPrint(), AsciiErrorPrint() to return 0 if the Simple Text Output Protocol OutputString() call returns an error.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10576 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/UefiLib.h
MdePkg/Library/UefiLib/UefiLibPrint.c

index 6d557e11cad125e66cb5c0eddb83c4f7808344e7..5c287762778af165b1ee7a89f232158bb02f69c2 100644 (file)
@@ -986,6 +986,7 @@ EfiGetNameGuidFromFwVolDevicePathNode (
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->ConOut is NULL, then ASSERT().\r
 \r
   @param Format   A null-terminated Unicode format string.\r
   @param ...      The variable argument list whose contents are accessed based \r
@@ -1012,6 +1013,7 @@ Print (
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->StdErr is NULL, then ASSERT().\r
 \r
   @param Format   A null-terminated Unicode format string.\r
   @param ...      The variable argument list whose contents are accessed based \r
@@ -1037,6 +1039,7 @@ ErrorPrint (
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
   If Format is NULL, then ASSERT().\r
+  If gST->ConOut is NULL, then ASSERT().\r
 \r
   @param Format   A null-terminated ASCII format string.\r
   @param ...      The variable argument list whose contents are accessed based \r
@@ -1062,6 +1065,7 @@ AsciiPrint (
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
   If Format is NULL, then ASSERT().\r
+  If gST->StdErr is NULL, then ASSERT().\r
 \r
   @param Format   A null-terminated ASCII format string.\r
   @param ...      The variable argument list whose contents are accessed based \r
@@ -1098,6 +1102,7 @@ AsciiErrorPrint (
   string is printed, and 0 is returned.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
 \r
   @param  PointX       X coordinate to print the string.\r
   @param  PointY       Y coordinate to print the string.\r
@@ -1147,6 +1152,7 @@ PrintXY (
   If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
   string is printed, and 0 is returned.\r
   If Format is NULL, then ASSERT().\r
+  If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
 \r
   @param  PointX       X coordinate to print the string.\r
   @param  PointY       Y coordinate to print the string.\r
index 81d9b7b5144de34acb260ddf7af04af90a86fca2..1c31ef1d5c28bb8318e87d0aea0172d7bd1b6c1a 100644 (file)
@@ -59,12 +59,14 @@ InternalPrint (
   IN  VA_LIST                          Marker\r
   )\r
 {\r
-  UINTN   Return;\r
-  CHAR16  *Buffer;\r
-  UINTN   BufferSize;\r
+  EFI_STATUS  Status;\r
+  UINTN       Return;\r
+  CHAR16      *Buffer;\r
+  UINTN       BufferSize;\r
 \r
   ASSERT (Format != NULL);\r
   ASSERT (((UINTN) Format & BIT0) == 0);\r
+  ASSERT (Console != NULL);\r
 \r
   BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
 \r
@@ -77,7 +79,10 @@ InternalPrint (
     //\r
     // To be extra safe make sure Console has been initialized\r
     //\r
-    Console->OutputString (Console, Buffer);\r
+    Status = Console->OutputString (Console, Buffer);\r
+    if (EFI_ERROR (Status)) {\r
+      Return = 0;\r
+    }\r
   }\r
 \r
   FreePool (Buffer);\r
@@ -96,6 +101,7 @@ InternalPrint (
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->ConOut is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
@@ -134,6 +140,7 @@ Print (
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->StdErr is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated Unicode format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
@@ -188,11 +195,13 @@ AsciiInternalPrint (
   IN  VA_LIST                          Marker\r
   )\r
 {\r
-  UINTN   Return;\r
-  CHAR16  *Buffer;\r
-  UINTN   BufferSize;\r
+  EFI_STATUS  Status;\r
+  UINTN       Return;\r
+  CHAR16      *Buffer;\r
+  UINTN       BufferSize;\r
 \r
   ASSERT (Format != NULL);\r
+  ASSERT (Console != NULL);\r
 \r
   BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
 \r
@@ -205,7 +214,10 @@ AsciiInternalPrint (
     //\r
     // To be extra safe make sure Console has been initialized\r
     //\r
-    Console->OutputString (Console, Buffer);\r
+    Status = Console->OutputString (Console, Buffer);\r
+    if (EFI_ERROR (Status)) {\r
+      Return = 0;\r
+    }\r
   }\r
 \r
   FreePool (Buffer);\r
@@ -223,6 +235,7 @@ AsciiInternalPrint (
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.\r
   If Format is NULL, then ASSERT().\r
+  If gST->ConOut is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
@@ -261,6 +274,7 @@ AsciiPrint (
   string is greater than PcdUefiLibMaxPrintBufferSize, then only the first \r
   PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.\r
   If Format is NULL, then ASSERT().\r
+  If gST->StdErr is NULL, then ASSERT().\r
 \r
   @param Format   Null-terminated ASCII format string.\r
   @param ...      Variable argument list whose contents are accessed based \r
@@ -357,6 +371,8 @@ InternalPrintGraphic (
   RowInfoArray          = NULL;\r
 \r
   ConsoleHandle = gST->ConsoleOutHandle;\r
+  \r
+  ASSERT( ConsoleHandle != NULL);\r
 \r
   Status = gBS->HandleProtocol (\r
                   ConsoleHandle,\r
@@ -558,6 +574,7 @@ Error:
   string is printed, and 0 is returned.\r
   If Format is NULL, then ASSERT().\r
   If Format is not aligned on a 16-bit boundary, then ASSERT().\r
+  If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
 \r
   @param  PointX       X coordinate to print the string.\r
   @param  PointY       Y coordinate to print the string.\r
@@ -634,6 +651,7 @@ PrintXY (
   If the EFI_HII_FONT_PROTOCOL is not present in the handle database, then no \r
   string is printed, and 0 is returned.\r
   If Format is NULL, then ASSERT().\r
+  If gST->ConsoleOutputHandle is NULL, then ASSERT().\r
 \r
   @param  PointX       X coordinate to print the string.\r
   @param  PointY       Y coordinate to print the string.\r