From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 AD4F081D2B for ; Fri, 28 Oct 2016 03:52:14 -0700 (PDT) Received: by mail-wm0-x234.google.com with SMTP id e69so92023556wmg.0 for ; Fri, 28 Oct 2016 03:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7ECPhnBHwTwWYfJnRyH6Y1S228ZsfSSJb1yha/i8Up0=; b=a8hI6c/je5KACoAa1crFLt9XUlEw+ZDX2bolcfYWRuJdScIAY2FWUN5VCY4YgZNiNI OAp+LI63yBKcH816wjJMB3dp/KqXezotSGiJwhlG3kRSX7uPpnpcfE8hrGHhKGTvz0No KyT4/fsxU7zs/K79utLESSMbqLYD3G9ssAnHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7ECPhnBHwTwWYfJnRyH6Y1S228ZsfSSJb1yha/i8Up0=; b=Lz7nr1u9qMTzBFpBZzafcK9/YEU0syjG/P/sajMH8300PLBjkzlGh8KuR5RpqDcz2F o8PZq2pjPmvORDuLlLF0MTHtSVp/zhyNmGz1uV3EX/sh2pmyAj87kbJbNpY0o8dTYcjE 6+g9yFv08XanhX1oZX1nl6KD+j5un3exlLQ+o1peVTOfFjQhAgtve8xIk4BH7L9ZwG6b d2nPk+XP6Bs3AJS70LhDwUa4RahiCeDMh1h2k3oZGZMVRLb9+MO/KNxmBoQroudtOpng Xuy+Jt+ci2LFY6kv7i2Iz6vqvM7bgiUWSKzB57ID7rSXVqPsTQbfIZq/us06uUTIsfoF F9eQ== X-Gm-Message-State: ABUngveoKmZ5v6i04onXmc5KPYs7Q0gVlQNcY51TS20r1Mbz9TU41TM5xbyy9kB1b+Yjdk7G X-Received: by 10.194.103.165 with SMTP id fx5mr10805900wjb.188.1477651933760; Fri, 28 Oct 2016 03:52:13 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id h2sm2855158wjy.40.2016.10.28.03.52.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Oct 2016 03:52:13 -0700 (PDT) Date: Fri, 28 Oct 2016 11:52:11 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, lersek@redhat.com, ryan.harkin@linaro.org Message-ID: <20161028105211.GD1161@bivouac.eciton.net> References: <1477646896-21444-1-git-send-email-ard.biesheuvel@linaro.org> <1477646896-21444-4-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1477646896-21444-4-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH v3 3/6] ArmPkg/LinuxLoader: eliminate calls to deprecated string functions 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: Fri, 28 Oct 2016 10:52:15 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 28, 2016 at 10:28:13AM +0100, Ard Biesheuvel wrote: > Remove calls to deprecated string functions like AsciiStrCpy() and > UnicodeStrToAsciiStr() > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ard Biesheuvel > Tested-by: Ryan Harkin > Reviewed-by: Laszlo Ersek Reviewed-by: Leif Lindholm > --- > ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c | 2 +- > ArmPkg/Application/LinuxLoader/LinuxLoader.c | 6 ++++-- > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c b/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c > index fd7ee9c8624d..0b3e2489c758 100644 > --- a/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c > +++ b/ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c > @@ -72,7 +72,7 @@ SetupCmdlineTag ( > mLinuxKernelCurrentAtag->header.type = ATAG_CMDLINE; > > /* place CommandLine into tag */ > - AsciiStrCpy (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, CmdLine); > + AsciiStrCpyS (mLinuxKernelCurrentAtag->body.cmdline_tag.cmdline, LineLength, CmdLine); > > // move pointer to next tag > mLinuxKernelCurrentAtag = next_tag_address (mLinuxKernelCurrentAtag); > diff --git a/ArmPkg/Application/LinuxLoader/LinuxLoader.c b/ArmPkg/Application/LinuxLoader/LinuxLoader.c > index 70b960b66f0e..76697c3a8c9d 100644 > --- a/ArmPkg/Application/LinuxLoader/LinuxLoader.c > +++ b/ArmPkg/Application/LinuxLoader/LinuxLoader.c > @@ -61,6 +61,7 @@ LinuxLoaderEntryPoint ( > LIST_ENTRY *ResourceLink; > SYSTEM_MEMORY_RESOURCE *Resource; > EFI_PHYSICAL_ADDRESS SystemMemoryBase; > + UINTN Length; > > Status = gBS->LocateProtocol ( > &gEfiDevicePathFromTextProtocolGuid, > @@ -182,12 +183,13 @@ LinuxLoaderEntryPoint ( > } > > if (LinuxCommandLine != NULL) { > - AsciiLinuxCommandLine = AllocatePool ((StrLen (LinuxCommandLine) + 1) * sizeof (CHAR8)); > + Length = StrLen (LinuxCommandLine) + 1; > + AsciiLinuxCommandLine = AllocatePool (Length); > if (AsciiLinuxCommandLine == NULL) { > Status = EFI_OUT_OF_RESOURCES; > goto Error; > } > - UnicodeStrToAsciiStr (LinuxCommandLine, AsciiLinuxCommandLine); > + UnicodeStrToAsciiStrS (LinuxCommandLine, AsciiLinuxCommandLine, Length); > } > > // > -- > 2.7.4 >