ArmPkg/LinuxLoader: eliminate calls to deprecated string functions

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>
This commit is contained in:
Ard Biesheuvel
2016-10-24 16:28:27 +01:00
parent a383ca341e
commit 9fbbbd1222
2 changed files with 5 additions and 3 deletions

View File

@@ -72,7 +72,7 @@ SetupCmdlineTag (
mLinuxKernelCurrentAtag->header.type = ATAG_CMDLINE; mLinuxKernelCurrentAtag->header.type = ATAG_CMDLINE;
/* place CommandLine into tag */ /* place CommandLine into tag */
AsciiStrCpy (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, CmdLine); AsciiStrCpyS (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, LineLength, CmdLine);
// move pointer to next tag // move pointer to next tag
mLinuxKernelCurrentAtag = next_tag_address (mLinuxKernelCurrentAtag); mLinuxKernelCurrentAtag = next_tag_address (mLinuxKernelCurrentAtag);

View File

@@ -61,6 +61,7 @@ LinuxLoaderEntryPoint (
LIST_ENTRY *ResourceLink; LIST_ENTRY *ResourceLink;
SYSTEM_MEMORY_RESOURCE *Resource; SYSTEM_MEMORY_RESOURCE *Resource;
EFI_PHYSICAL_ADDRESS SystemMemoryBase; EFI_PHYSICAL_ADDRESS SystemMemoryBase;
UINTN Length;
Status = gBS->LocateProtocol ( Status = gBS->LocateProtocol (
&gEfiDevicePathFromTextProtocolGuid, &gEfiDevicePathFromTextProtocolGuid,
@@ -182,12 +183,13 @@ LinuxLoaderEntryPoint (
} }
if (LinuxCommandLine != NULL) { if (LinuxCommandLine != NULL) {
AsciiLinuxCommandLine = AllocatePool ((StrLen (LinuxCommandLine) + 1) * sizeof (CHAR8)); Length = StrLen (LinuxCommandLine) + 1;
AsciiLinuxCommandLine = AllocatePool (Length);
if (AsciiLinuxCommandLine == NULL) { if (AsciiLinuxCommandLine == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Error; goto Error;
} }
UnicodeStrToAsciiStr (LinuxCommandLine, AsciiLinuxCommandLine); UnicodeStrToAsciiStrS (LinuxCommandLine, AsciiLinuxCommandLine, Length);
} }
// //