From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3EE4F1A1E13 for ; Sun, 7 Aug 2016 22:44:37 -0700 (PDT) Received: by mail-wm0-x242.google.com with SMTP id q128so13332268wma.1 for ; Sun, 07 Aug 2016 22:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=zOzXo80v0F2xdKxTIOue9fA5pK/ymkZfRQpruXQSOkg=; b=jx49bOYfofjcDVugDpRF4emEH9gjj41quF2yxPkrYdHCpZH2v0BHpYMnjeh8RtpShp MouNEZmS+JHWYrRmoXPKYOMtLpMFcwZ0lVsv1K8F6dAzZnaYVw3d4x0LIwC4x7RM5fnB oPzm/SzJgmNmPSYdvv4qgV61oo9xCJMKIsJRivr6ChgOs0RtFOQ/BtkYD6rsGHcJ5S9F 06ZwPL2Jz0bLSOq5DNHRcUIXxCHD+R/stsOhHfZq9iyY0KHK6qqxqslkHSyS0F4T878N ubdMfxTXKg8C2h7hyybtNmlRpIEfr7pmvo66kkjXFNj94QOwEGW6jAHn0n6G49lHa23X 11Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=zOzXo80v0F2xdKxTIOue9fA5pK/ymkZfRQpruXQSOkg=; b=ZxGyCGBYLpEbZZK6pkJzHM7hk5H2PA1uoJr+R3KIeqUqv+n5byjWoa2VoixK6x2KUd UHmm9N3g0OY1YmgFAqeP4ggNg/wqHUEjSKD8eJzMUsIPZXhArhK17FRjuG3e5jiWrTex uOkOv8igBKil+V8rwt8QShpQUI1g1SsPU+bS7p7lffRbenZ8nvoOUy534lSl4Tp72CSW 0yShaAlnTMUL7+vcOyh1jPL67tHu4DU03VHO8EN5CkMsiKxFBaCAxZ01nQ1FIFqYYYdj t0x4Yav/FlSQqBxlFEiIYW6M1t7yO+V9ZfdPO83An8G5LAuW9gr5tTwtk5nL/rhjG9bZ h+eg== X-Gm-Message-State: AEkoouvvUKVgRf6BmK6O4BKJF3xjjSG8quU5BxUPfJkutOtLHUIa6JDlUbaxoqpgTLEO51LlzVGBqW70qthDfg== X-Received: by 10.194.120.129 with SMTP id lc1mr82336441wjb.131.1470635074667; Sun, 07 Aug 2016 22:44:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.238.198 with HTTP; Sun, 7 Aug 2016 22:44:34 -0700 (PDT) From: Michael Zimmermann Date: Mon, 8 Aug 2016 07:44:34 +0200 Message-ID: To: edk2-devel-01 , Leif Lindholm , Ard Biesheuvel X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [PATCH] ArmPkg: remove usages of deprecated API's X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2016 05:44:37 -0000 Content-Type: text/plain; charset=UTF-8 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Zimmermann --- ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c | 21 +++++++++++---------- .../Library/ArmDisassemblerLib/ThumbDisassembler.c | 19 ++++++++++--------- .../Arm/DefaultExceptionHandler.c | 9 ++++++--- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c index 29a8d44..410078f 100644 --- a/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c +++ b/ArmPkg/Library/ArmDisassemblerLib/ArmDisassembler.c @@ -80,7 +80,8 @@ CHAR8 *gLdmStack[] = { #define BYTE(_B) ((_B) ? "B":"") #define USER(_B) ((_B) ? "^" : "") -CHAR8 mMregListStr[4*15 + 1]; +#define REGLISTSTR_SIZE (4*15 + 1) +CHAR8 mMregListStr[REGLISTSTR_SIZE]; CHAR8 * MRegList ( @@ -93,7 +94,7 @@ MRegList ( Str = mMregListStr; *Str = '\0'; - AsciiStrCat (Str, "{"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "{"); for (Index = 0, First = TRUE; Index <= 15; Index++) { if ((OpCode & (1 << Index)) != 0) { Start = End = Index; @@ -102,25 +103,25 @@ MRegList ( } if (!First) { - AsciiStrCat (Str, ","); + AsciiStrCatS (Str, REGLISTSTR_SIZE, ","); } else { First = FALSE; } if (Start == End) { - AsciiStrCat (Str, gReg[Start]); - AsciiStrCat (Str, ", "); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[Start]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, ", "); } else { - AsciiStrCat (Str, gReg[Start]); - AsciiStrCat (Str, "-"); - AsciiStrCat (Str, gReg[End]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[Start]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "-"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[End]); } } } if (First) { - AsciiStrCat (Str, "ERROR"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "ERROR"); } - AsciiStrCat (Str, "}"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "}"); // BugBug: Make caller pass in buffer it is cleaner return mMregListStr; diff --git a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c index 5bad3af..4f3af9a 100644 --- a/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c +++ b/ArmPkg/Library/ArmDisassemblerLib/ThumbDisassembler.c @@ -389,7 +389,8 @@ CHAR8 *gShiftType[] = { "ROR" }; -CHAR8 mThumbMregListStr[4*15 + 1]; +#define REGLISTSTR_SIZE (4*15 + 1) +CHAR8 mThumbMregListStr[REGLISTSTR_SIZE]; CHAR8 * ThumbMRegList ( @@ -402,7 +403,7 @@ ThumbMRegList ( Str = mThumbMregListStr; *Str = '\0'; - AsciiStrCat (Str, "{"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "{"); for (Index = 0, First = TRUE; Index <= 15; Index++) { if ((RegBitMask & (1 << Index)) != 0) { @@ -412,24 +413,24 @@ ThumbMRegList ( } if (!First) { - AsciiStrCat (Str, ","); + AsciiStrCatS (Str, REGLISTSTR_SIZE, ","); } else { First = FALSE; } if (Start == End) { - AsciiStrCat (Str, gReg[Start]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[Start]); } else { - AsciiStrCat (Str, gReg[Start]); - AsciiStrCat (Str, "-"); - AsciiStrCat (Str, gReg[End]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[Start]); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "-"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, gReg[End]); } } } if (First) { - AsciiStrCat (Str, "ERROR"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "ERROR"); } - AsciiStrCat (Str, "}"); + AsciiStrCatS (Str, REGLISTSTR_SIZE, "}"); // BugBug: Make caller pass in buffer it is cleaner return mThumbMregListStr; diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c index aece263..fe4abb6 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c @@ -47,12 +47,14 @@ GetImageName ( @param Cpsr ARM CPSR register value @param ReturnStr 32 byte string that contains string version of CPSR + @param ReturnSize The size of ReturnSize including the terminating null char. **/ VOID CpsrString ( IN UINT32 Cpsr, - OUT CHAR8 *ReturnStr + OUT CHAR8 *ReturnStr, + IN UINTN ReturnSize ) { UINTN Index; @@ -84,6 +86,7 @@ CpsrString ( *Str++ = '_'; *Str = '\0'; + ReturnSize--; switch (Cpsr & 0x1f) { case 0x10: @@ -116,7 +119,7 @@ CpsrString ( break; } - AsciiStrCat (Str, ModeStr); + AsciiStrCatS (Str, ReturnSize, ModeStr); return; } @@ -197,7 +200,7 @@ DefaultExceptionHandler ( UINT8 *DisAsm; UINT32 ItBlock; - CpsrString (SystemContext.SystemContextArm->CPSR, CpsrStr); + CpsrString (SystemContext.SystemContextArm->CPSR, CpsrStr, sizeof(CpsrStr)); DEBUG ((EFI_D_ERROR, "%a\n", CpsrStr)); Pdb = GetImageName (SystemContext.SystemContextArm->PC, &ImageBase, &PeCoffSizeOfHeader); -- 2.9.2