From patchwork Wed Oct 26 08:17:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 79357 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp284278qge; Wed, 26 Oct 2016 01:17:59 -0700 (PDT) X-Received: by 10.98.61.85 with SMTP id k82mr1922982pfa.7.1477469879906; Wed, 26 Oct 2016 01:17:59 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id v77si1357858pfj.61.2016.10.26.01.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2016 01:17:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A9C331A1E73; Wed, 26 Oct 2016 01:17:58 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (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 821DB1A1E86 for ; Wed, 26 Oct 2016 01:17:56 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id 140so7384977wmv.0 for ; Wed, 26 Oct 2016 01:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0hA+ueqrJRvVDtXi71dkVI0ipWbWZZSxaSmFMcPBNT0=; b=NQBG72cTh5RITaAUMw+RMrG3LYmQKVFX9Szo2QBhP6sbzKUi6VAp1TGQRwOTFpgbE2 qX0YkcDUhuOftdXqQOtWRNpsyRW0D0gQdtTuxP/tpISzm8zaYeIeqXRVzOpCVAvl881u 37Sb79IvB+gqxu3ODs8kfkWhaCOYh3POqTHr4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0hA+ueqrJRvVDtXi71dkVI0ipWbWZZSxaSmFMcPBNT0=; b=UyJul1GrJPA+NAypprNLFYwzpsM7x8J0+BiEIgAZY8tkdPXQ0rZH85vRC/IkPl8Gvv Z+j8ALb46V9sY0ByJ9fTK0hsWJ9+LbEFIN6VXd3jc+k8WKSp07PN3BCOXy/Eq/QHn/IN l046Ubdu1bGRto48/Ud6Nqn6ROL6Nxlg7KPwMZY7+jGRWdqhYgi2cxsxIUF22IjogWCp fDBlv302EMWhqXJyK8ybzgwimm5p51OWUFza4eHuD6HJvKONGpjDbnAIH2Zb2KkpA3Eg JKuRAHVRuFmljzSJQzfhSYdy8UuUNrquCEec6+MCzeiHJoYgQXpt9IrYf+oV3JVasYca 6wlA== X-Gm-Message-State: ABUngvfI+g3i0Sj3PfcmI3imDU426EsqnOYIDYfRag53OvZB5TYdDv0HLcKa4EphsZN7VuPb X-Received: by 10.194.220.232 with SMTP id pz8mr1157946wjc.154.1477469875141; Wed, 26 Oct 2016 01:17:55 -0700 (PDT) Received: from localhost.localdomain ([105.150.227.229]) by smtp.gmail.com with ESMTPSA id y2sm1166640wjx.20.2016.10.26.01.17.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 01:17:54 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 26 Oct 2016 09:17:39 +0100 Message-Id: <1477469862-10046-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477469862-10046-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477469862-10046-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 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: , Cc: ryan.harkin@linaro.org, lersek@redhat.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPkg/Application/LinuxLoader/Arm/LinuxAtag.c | 2 +- ArmPkg/Application/LinuxLoader/LinuxLoader.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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); } //