diff --git a/ArmPkg/Library/SemiHostingSerialPortLib/SerialPortLib.c b/ArmPkg/Library/SemiHostingSerialPortLib/SerialPortLib.c index 7e5c61fad4..e35bcee380 100644 --- a/ArmPkg/Library/SemiHostingSerialPortLib/SerialPortLib.c +++ b/ArmPkg/Library/SemiHostingSerialPortLib/SerialPortLib.c @@ -2,6 +2,7 @@ Serial I/O Port library functions with no library constructor/destructor Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+ Copyright (c) 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -55,10 +56,13 @@ SerialPortWrite ( ) { UINT8 PrintBuffer[PRINT_BUFFER_SIZE]; - UINTN SourceIndex = 0; - UINTN DestinationIndex = 0; + UINTN SourceIndex; + UINTN DestinationIndex; UINT8 CurrentCharacter; + SourceIndex = 0; + DestinationIndex = 0; + while (SourceIndex < NumberOfBytes) { CurrentCharacter = Buffer[SourceIndex++];