]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/LinuxLoader: eliminate calls to deprecated string functions
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 24 Oct 2016 15:28:27 +0000 (16:28 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 28 Oct 2016 11:03:53 +0000 (12:03 +0100)
Remove calls to deprecated string functions like AsciiStrCpy() and
UnicodeStrToAsciiStr()

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c
ArmPkg/Application/LinuxLoader/LinuxLoader.c

index fd7ee9c8624dabd09c3b2be53b0bb6d9e2662930..0b3e2489c7582d502e249f6e19a2d96f16deddb8 100644 (file)
@@ -72,7 +72,7 @@ SetupCmdlineTag (
     mLinuxKernelCurrentAtag->header.type = ATAG_CMDLINE;\r
 \r
     /* place CommandLine into tag */\r
-    AsciiStrCpy (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, CmdLine);\r
+    AsciiStrCpyS (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, LineLength, CmdLine);\r
 \r
     // move pointer to next tag\r
     mLinuxKernelCurrentAtag = next_tag_address (mLinuxKernelCurrentAtag);\r
index 70b960b66f0e4a0f35744a3f2a74cf0a950929f4..76697c3a8c9d22612d376c4ac815bddbbbc6bf80 100644 (file)
@@ -61,6 +61,7 @@ LinuxLoaderEntryPoint (
   LIST_ENTRY                          *ResourceLink;\r
   SYSTEM_MEMORY_RESOURCE              *Resource;\r
   EFI_PHYSICAL_ADDRESS                SystemMemoryBase;\r
+  UINTN                               Length;\r
 \r
   Status = gBS->LocateProtocol (\r
                   &gEfiDevicePathFromTextProtocolGuid,\r
@@ -182,12 +183,13 @@ LinuxLoaderEntryPoint (
   }\r
 \r
   if (LinuxCommandLine != NULL) {\r
-    AsciiLinuxCommandLine = AllocatePool ((StrLen (LinuxCommandLine) + 1) * sizeof (CHAR8));\r
+    Length = StrLen (LinuxCommandLine) + 1;\r
+    AsciiLinuxCommandLine = AllocatePool (Length);\r
     if (AsciiLinuxCommandLine == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       goto Error;\r
     }\r
-    UnicodeStrToAsciiStr (LinuxCommandLine, AsciiLinuxCommandLine);\r
+    UnicodeStrToAsciiStrS (LinuxCommandLine, AsciiLinuxCommandLine, Length);\r
   }\r
 \r
   //\r