From 3bbe68a3627e7c75474955352f27b923c5831ad7 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Wed, 1 Feb 2012 06:06:08 +0000 Subject: [PATCH] Add Missing invocations to VA_END() for VA_START(). Signed-off-by: rsun3 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12979 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/Dxe/EfiDriverLib/Handle.c | 6 ++++- .../Foundation/Library/Dxe/Graphics/Print.c | 10 ++++--- .../Library/Dxe/GraphicsLite/Print.c | 10 ++++--- .../Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c | 6 ++++- .../Library/BaseLib/SwitchStack.c | 3 ++- .../Library/BasePrintLib/PrintLib.c | 27 ++++++++++++++----- .../Library/EdkDxeSalLib/Ipf/EsalServiceLib.c | 4 ++- .../Foundation/Library/Pei/PeiLib/Debug.c | 4 +-- .../RuntimeDxe/EfiRuntimeLib/Ipf/RuntimeLib.c | 4 ++- .../FvbServicesRuntimeDxe/FWBlockService.c | 8 ++---- .../PeiDxeDebugLibReportStatusCode/DebugLib.c | 3 ++- .../Library/FrameworkUefiLib/UefiLibPrint.c | 6 ++++- .../DxePrintLibPrint2Protocol/PrintLib.c | 27 ++++++++++++++----- .../Universal/EbcDxe/Ipf/EbcSupport.c | 3 ++- .../Universal/SetupBrowserDxe/Print.c | 12 ++++++--- MdeModulePkg/Universal/SetupBrowserDxe/Ui.c | 4 +-- MdePkg/Library/BasePrintLib/PrintLib.c | 22 +++++++++++---- .../Library/BasePrintLib/PrintLibInternal.c | 7 +++-- .../DxeExtendedSalLib/ExtendedSalLib.c | 4 ++- .../DxeRuntimeExtendedSalLib/ExtendedSalLib.c | 4 ++- MdePkg/Library/UefiLib/UefiLibPrint.c | 12 +++++++-- .../FvbServicesRuntimeDxe/FWBlockService.c | 8 ++---- Nt32Pkg/Sec/SecMain.c | 4 ++- OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c | 3 ++- PerformancePkg/Dp_App/DpUtilities.c | 4 ++- SecurityPkg/Tcg/TcgDxe/TisDxe.c | 12 +++++---- .../UefiFileHandleLib/UefiFileHandleLib.c | 6 ++--- .../FvbServicesRuntimeDxe/FWBlockService.c | 8 ++---- 28 files changed, 156 insertions(+), 75 deletions(-) diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/Handle.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/Handle.c index 9cf391d408..b6484731e9 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/Handle.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/Handle.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -71,6 +71,7 @@ Returns: AnInterface = NULL; VA_START (args, Interface); ProtocolFirst = VA_ARG (args, EFI_GUID *); + VA_END (args); // // Get list of all handles that support the first protocol. @@ -146,6 +147,8 @@ Returns: ); } + VA_END (args); + goto lbl_out; } @@ -163,6 +166,7 @@ Returns: } } + VA_END (args); } // diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c index 2c8dc73ae6..83939670f6 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -416,8 +416,7 @@ Returns: EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto; EFI_STATUS Status; VA_LIST Args; - - VA_START (Args, Fmt); + UINTN LengthOfPrinted; Handle = gST->ConsoleOutHandle; @@ -454,7 +453,10 @@ Returns: return 0; } - return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args); + VA_START (Args, Fmt); + LengthOfPrinted = _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args); + VA_END (Args); + return LengthOfPrinted; } diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c index 0988cc2f30..1492e53d68 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Print.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -390,8 +390,7 @@ Returns: EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto; EFI_STATUS Status; VA_LIST Args; - - VA_START (Args, Fmt); + UINTN LengthOfPrinted; Handle = gST->ConsoleOutHandle; @@ -428,7 +427,10 @@ Returns: return 0; } - return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args); + VA_START (Args, Fmt); + LengthOfPrinted = _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args); + VA_END (Args); + return LengthOfPrinted; } diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c index b0c9a7f1f2..1452ef0035 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -508,6 +508,7 @@ Returns: StackString = VA_ARG (Marker, CHAR16 *); if (StackString == NULL) { + VA_END (Marker); return EFI_INVALID_PARAMETER; } @@ -517,6 +518,7 @@ Returns: LargestString = StringLen; } } + VA_END (Marker); if ((LargestString + 2) > DimensionsWidth) { LargestString = DimensionsWidth - 2; @@ -682,6 +684,7 @@ ExtractDefault( BufferPos += Width; if ((UINTN)(Offset + Width) > *BufferSize) { + VA_END (Args); return EFI_BUFFER_TOO_SMALL; } @@ -1025,6 +1028,7 @@ ConstructConfigAltResp ( BufToHexString (StringPtr + 8, &StrBufferLen, (UINT8 *) &AltCfgId, sizeof (UINT16)); Status = ExtractBlockConfig (DefaultValueArray, &AltCfg[Index]); if (EFI_ERROR (Status)) { + VA_END (Args); return Status; } AltRespLen += EfiStrLen (AltCfg[Index]); diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c index 92b7cba0c6..d9b7548906 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/SwitchStack.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -65,6 +65,7 @@ SwitchStack ( InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker); + VA_END (Marker); // // InternalSwitchStack () will never return // diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/PrintLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/PrintLib.c index ecb55ebb2f..3258b016b5 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/PrintLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/PrintLib.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -601,9 +601,12 @@ BasePrintLibSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker); + NumberOfPrinted = BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -696,9 +699,12 @@ UnicodeSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -789,9 +795,12 @@ UnicodeSPrintAsciiFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -933,9 +942,12 @@ AsciiSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -1026,9 +1038,12 @@ AsciiSPrintUnicodeFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c index 288c431cdc..c347bf2948 100644 --- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -143,6 +143,8 @@ Returns: Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal); } + VA_END (Args); + if (EFI_ERROR (Status)) { return Status; } diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Debug.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Debug.c index ce257c4e1c..eaf785bd36 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Debug.c +++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Debug.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2005, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -113,6 +113,7 @@ Returns: VA_START (Marker, Format); EfiDebugVPrintWorker (ErrorLevel, Format, Marker, sizeof (Buffer), Buffer); + VA_END (Marker); // // We choose NOT to use PEI_REPORT_STATUS_CODE here, because when debug is enable, @@ -127,5 +128,4 @@ Returns: (EFI_STATUS_CODE_DATA *) Buffer ); - return ; } diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/RuntimeLib.c index 2e63672582..d826b9000e 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Ipf/RuntimeLib.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -311,6 +311,8 @@ Returns: Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal); } + VA_END (Args); + if (EFI_ERROR (Status)) { return Status; } diff --git a/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c b/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c index 9513d05bed..44df1172b1 100644 --- a/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/EmulatorPkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -1,6 +1,6 @@ /*++ @file -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
Portions copyright (c) 2011, Apple Inc. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -911,14 +911,10 @@ Returns: // // Check input parameters // - if (NumOfLba == 0) { + if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) { VA_END (args); return EFI_INVALID_PARAMETER; } - - if ((StartingLba + NumOfLba) > NumOfBlocks) { - return EFI_INVALID_PARAMETER; - } } while (1); VA_END (args); diff --git a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c index e4ca5b5539..f6ab54ed6a 100644 --- a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c +++ b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c @@ -4,7 +4,7 @@ Note that if the debug message length is larger than the maximum allowable record length, then the debug message will be ignored directly. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -207,6 +207,7 @@ DebugPrint ( // If the converted BASE_LIST is larger than the 12 * sizeof (UINT64) allocated bytes, then return // if ((CHAR8 *)BaseListMarker > FormatString) { + VA_END (VaListMarker); return; } } diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c index 3f4f4f5f57..a4d1f02718 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLibPrint.c @@ -2,7 +2,7 @@ Mde UEFI library API implementation. Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE - Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -623,6 +623,8 @@ PrintXY ( PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker); + VA_END (Marker); + ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); FreePool (Buffer); @@ -699,6 +701,8 @@ AsciiPrintXY ( PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker); + VA_END (Marker); + ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); FreePool (Buffer); diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c index 3b4d4e03ad..c0750ad176 100644 --- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c +++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c @@ -6,7 +6,7 @@ protocol related to this implementation, not in the public spec. So, this library instance is only for this code base. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -366,9 +366,12 @@ UnicodeSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -515,9 +518,12 @@ UnicodeSPrintAsciiFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -714,9 +720,12 @@ AsciiSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -863,9 +872,12 @@ AsciiSPrintUnicodeFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } @@ -1056,9 +1068,12 @@ InternalPrintLibSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return InternalPrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL); + NumberOfPrinted = InternalPrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL); + VA_END (Marker); + return NumberOfPrinted; } #define WARNING_STATUS_NUMBER 4 diff --git a/MdeModulePkg/Universal/EbcDxe/Ipf/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/Ipf/EbcSupport.c index 1321dd4288..23b6c1bd84 100644 --- a/MdeModulePkg/Universal/EbcDxe/Ipf/EbcSupport.c +++ b/MdeModulePkg/Universal/EbcDxe/Ipf/EbcSupport.c @@ -2,7 +2,7 @@ This module contains EBC support routines that are customized based on the target processor. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -134,6 +134,7 @@ EbcInterpret ( Arg14 = VA_ARG (List, UINT64); Arg15 = VA_ARG (List, UINT64); Arg16 = VA_ARG (List, UINT64); + VA_END (List); // // Now clear out our context // diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Print.c b/MdeModulePkg/Universal/SetupBrowserDxe/Print.c index 941d0958f9..eeadf2494f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Print.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Print.c @@ -15,7 +15,7 @@ type: '%' - Print a % -Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -152,9 +152,12 @@ ConsolePrint ( ) { VA_LIST Args; + UINTN LengthOfPrinted; VA_START (Args, Fmt); - return PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, Fmt, Args); + LengthOfPrinted = PrintInternal ((UINTN) -1, (UINTN) -1, gST->ConOut, Fmt, Args); + VA_END (Args); + return LengthOfPrinted; } @@ -216,9 +219,12 @@ PrintAt ( ) { VA_LIST Args; + UINTN LengthOfPrinted; VA_START (Args, Fmt); - return PrintInternal (Column, Row, gST->ConOut, Fmt, Args); + LengthOfPrinted = PrintInternal (Column, Row, gST->ConOut, Fmt, Args); + VA_END (Args); + return LengthOfPrinted; } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c index 7c6a032f8b..1c3a7f6ba4 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c @@ -852,8 +852,6 @@ CreateDialog ( ASSERT (TempString); ASSERT (BufferedString); - VA_START (Marker, KeyValue); - // // Zero the outgoing buffer // @@ -875,6 +873,8 @@ CreateDialog ( LargestString = 0; + VA_START (Marker, KeyValue); + // // Determine the largest string in the dialog box // Notice we are starting with 1 since String is the first string diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/BasePrintLib/PrintLib.c index daeb8d4536..43b2b3c1d3 100644 --- a/MdePkg/Library/BasePrintLib/PrintLib.c +++ b/MdePkg/Library/BasePrintLib/PrintLib.c @@ -1,7 +1,7 @@ /** @file Base Print Library instance implementation. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -165,9 +165,12 @@ UnicodeSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -306,9 +309,12 @@ UnicodeSPrintAsciiFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -496,9 +502,12 @@ AsciiSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } /** @@ -637,9 +646,12 @@ AsciiSPrintUnicodeFormat ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker); + VA_END (Marker); + return NumberOfPrinted; } diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c index 30451b922e..8a0cfa6e20 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c @@ -1,7 +1,7 @@ /** @file Print Library internal worker functions. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -982,7 +982,10 @@ BasePrintLibSPrint ( ) { VA_LIST Marker; + UINTN NumberOfPrinted; VA_START (Marker, FormatString); - return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL); + NumberOfPrinted = BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL); + VA_END (Marker); + return NumberOfPrinted; } diff --git a/MdePkg/Library/DxeExtendedSalLib/ExtendedSalLib.c b/MdePkg/Library/DxeExtendedSalLib/ExtendedSalLib.c index 82266f5df0..0f48c63f7b 100644 --- a/MdePkg/Library/DxeExtendedSalLib/ExtendedSalLib.c +++ b/MdePkg/Library/DxeExtendedSalLib/ExtendedSalLib.c @@ -1,7 +1,7 @@ /** @file The library implements the Extended SAL Library Class for boot service only modules. - Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -196,6 +196,8 @@ RegisterEsalClass ( Status = RegisterEsalFunction (FunctionId, ClassGuidLo, ClassGuidHi, Function, ModuleGlobal); } + VA_END (Args); + if (EFI_ERROR (Status)) { return Status; } diff --git a/MdePkg/Library/DxeRuntimeExtendedSalLib/ExtendedSalLib.c b/MdePkg/Library/DxeRuntimeExtendedSalLib/ExtendedSalLib.c index 1a599e6687..f9e974b373 100644 --- a/MdePkg/Library/DxeRuntimeExtendedSalLib/ExtendedSalLib.c +++ b/MdePkg/Library/DxeRuntimeExtendedSalLib/ExtendedSalLib.c @@ -1,7 +1,7 @@ /** @file This library implements the Extended SAL Library Class for use in boot services and runtime. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -319,6 +319,8 @@ RegisterEsalClass ( Status = RegisterEsalFunction (FunctionId, ClassGuidLo, ClassGuidHi, Function, ModuleGlobal); } + VA_END (Args); + if (EFI_ERROR (Status)) { return Status; } diff --git a/MdePkg/Library/UefiLib/UefiLibPrint.c b/MdePkg/Library/UefiLib/UefiLibPrint.c index 8ecb58dbe9..6eadc120c8 100644 --- a/MdePkg/Library/UefiLib/UefiLibPrint.c +++ b/MdePkg/Library/UefiLib/UefiLibPrint.c @@ -2,7 +2,7 @@ Mde UEFI library API implementation. Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE - Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -623,6 +623,8 @@ PrintXY ( PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker); + VA_END (Marker); + ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); FreePool (Buffer); @@ -699,6 +701,8 @@ AsciiPrintXY ( PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker); + VA_END (Marker); + ReturnNum = InternalPrintGraphic (PointX, PointY, ForeGround, BackGround, Buffer, PrintNum); FreePool (Buffer); @@ -796,7 +800,11 @@ CatSPrint ( ) { VA_LIST Marker; + CHAR16 *NewString; + VA_START (Marker, FormatString); - return (CatVSPrint(String, FormatString, Marker)); + NewString = CatVSPrint(String, FormatString, Marker); + VA_END (Marker); + return NewString; } diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c index 2028c606ab..67d88c650c 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -1,6 +1,6 @@ /**@file -Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -950,14 +950,10 @@ Returns: // // Check input parameters // - if (NumOfLba == 0) { + if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) { VA_END (args); return EFI_INVALID_PARAMETER; } - - if ((StartingLba + NumOfLba) > NumOfBlocks) { - return EFI_INVALID_PARAMETER; - } } while (1); VA_END (args); diff --git a/Nt32Pkg/Sec/SecMain.c b/Nt32Pkg/Sec/SecMain.c index 0c859a2650..a1d43d2eba 100644 --- a/Nt32Pkg/Sec/SecMain.c +++ b/Nt32Pkg/Sec/SecMain.c @@ -1,6 +1,6 @@ /**@file -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -123,6 +123,8 @@ SecPrint ( _vsnprintf (Buffer, sizeof (Buffer), Format, Marker); + va_end (Marker); + CharCount = strlen (Buffer); WriteFile ( GetStdHandle (STD_OUTPUT_HANDLE), diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c index 742c98a03e..ea9ffdcd61 100644 --- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c +++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c @@ -2,7 +2,7 @@ Firmware Block Services to support emulating non-volatile variables by pretending that a memory buffer is storage for the NV variables. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -379,6 +379,7 @@ FvbProtocolEraseBlocks ( ); VA_START (args, This); PlatformFvbBlocksErased (This, args); + VA_END (args); } return EFI_SUCCESS; diff --git a/PerformancePkg/Dp_App/DpUtilities.c b/PerformancePkg/Dp_App/DpUtilities.c index 873620826d..f60006125f 100644 --- a/PerformancePkg/Dp_App/DpUtilities.c +++ b/PerformancePkg/Dp_App/DpUtilities.c @@ -1,7 +1,7 @@ /** @file Utility functions used by the Dp application. - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -421,6 +421,8 @@ PrintToken ( SetMem( mPrintTokenBuffer, BufferSize, 0); Return = UnicodeVSPrint (mPrintTokenBuffer, BufferSize, StringPtr, Marker); + VA_END (Marker); + if (Return > 0 && gST->ConOut != NULL) { gST->ConOut->OutputString (gST->ConOut, mPrintTokenBuffer); } diff --git a/SecurityPkg/Tcg/TcgDxe/TisDxe.c b/SecurityPkg/Tcg/TcgDxe/TisDxe.c index 635ff77e13..68489d3e3f 100644 --- a/SecurityPkg/Tcg/TcgDxe/TisDxe.c +++ b/SecurityPkg/Tcg/TcgDxe/TisDxe.c @@ -1,7 +1,7 @@ /** @file TIS (TPM Interface Specification) functions used by TPM Dxe driver. -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -376,7 +376,7 @@ TisPcExecute ( if (*Fmt == '/') break; Status = TisPcSendV (*Fmt, &Ap, TpmCommandBuf, &BufSize); if (EFI_ERROR( Status )) { - return Status; + goto Error; } Fmt++; } @@ -389,7 +389,7 @@ TisPcExecute ( // Ensure the TPM state change from "Reception" to "Idle/Ready" // MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_READY); - return Status; + goto Error; } MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_GO); @@ -404,7 +404,7 @@ TisPcExecute ( // MmioWrite8 ((UINTN) &(((TIS_PC_REGISTERS_PTR) TisReg)->Status), TIS_PC_STS_READY); if (EFI_ERROR (Status)) { - return Status; + goto Error; } // @@ -418,14 +418,16 @@ TisPcExecute ( } Status = TisPcReceiveV (*Fmt, &Ap, TpmCommandBuf, &BufSize, ResponseSize, &DataFinished); if (EFI_ERROR (Status)) { - return Status; + goto Error; } if (DataFinished) { + VA_END (Ap); return EFI_SUCCESS; } Fmt++; } +Error: VA_END (Ap); return Status; } diff --git a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c index 0e2f93debc..0bee8e3899 100644 --- a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c +++ b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c @@ -1,7 +1,7 @@ /** @file Provides interface to EFI_FILE_HANDLE functionality. - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1089,8 +1089,6 @@ FileHandlePrintLine( CHAR16 *Buffer; EFI_STATUS Status; - VA_START (Marker, Format); - // // Get a buffer to print into // @@ -1100,7 +1098,9 @@ FileHandlePrintLine( // // Print into our buffer // + VA_START (Marker, Format); UnicodeVSPrint (Buffer, PcdGet16 (PcdShellPrintBufferSize), Format, Marker); + VA_END (Marker); // // Print buffer into file diff --git a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c b/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c index c3e4df2f82..b49a660eab 100644 --- a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -918,14 +918,10 @@ Returns: // // Check input parameters // - if (NumOfLba == 0) { + if (NumOfLba == 0 || (StartingLba + NumOfLba) > NumOfBlocks) { VA_END (args); return EFI_INVALID_PARAMETER; } - - if ((StartingLba + NumOfLba) > NumOfBlocks) { - return EFI_INVALID_PARAMETER; - } } while (1); VA_END (args); -- 2.39.2