From patchwork Mon Oct 24 16:06:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 78990 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2658620qge; Mon, 24 Oct 2016 09:07:09 -0700 (PDT) X-Received: by 10.36.83.213 with SMTP id n204mr2870747itb.100.1477325229870; Mon, 24 Oct 2016 09:07:09 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c184si16087178pga.252.2016.10.24.09.07.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 09:07:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; 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 198.145.21.10 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 3BCE41A1E8B; Mon, 24 Oct 2016 09:07:08 -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 3F13B1A1E73 for ; Mon, 24 Oct 2016 09:07:05 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id c78so111954866wme.0 for ; Mon, 24 Oct 2016 09:07:05 -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=rqdsmIecXp61ZCFrRK7PPKmBLSwy8AWXTNdncVkVIe4=; b=LwHpccYe9xylEMS1+XFwwnGnvHr4K0vwIb3LADhEgqc53sgMTQkloYm+LfzGzAwHTW cYGNR96VeS6z0Z37xWmu3QHRGVSqHRqucT3lCnOwUZJS1EFo5p4WykhmzRlVVTLgUKxU 61CrfJpFk/PmC2IovofW1kj1VsaEfQrIITaSw= 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=rqdsmIecXp61ZCFrRK7PPKmBLSwy8AWXTNdncVkVIe4=; b=msXembUtSFxK/dFtRFTT8TMCc+ucoDS81BVXMMlL5mEHsTqjHuSNG/XgNMv9JywRHR ux1lFEStJJJnQIZngzvxUFLC5gnDd0PW4IpwYqN9zoT2/YbdyHiT9bvp11YEPP0QRBy1 lENhDWl6cC2W9EYqnBUKobnQZV27Jl40lNf1rvLEmlhss9vG5LFEtR+Crlsgz6iMTAaC U2WZEUyI6D4NTP+1nA+D78FPjzIDJTTV9jQUJ/s1wDj+VgmvEToQ7i0zNwoZrH6wzn0T 4l9NXp2OEC2IsSXHhhgcvBpz8SOZopnYCD+4eON/Z4WiNsrRhxhEM2ZBl20W0EimDyQB 66Pg== X-Gm-Message-State: AA6/9RlvUND725qdDw34kXYJ/2RigF3bvksSg4mZ2TI06CSjRZ38KcFL6n2nLnfHon5pYRGB X-Received: by 10.28.27.143 with SMTP id b137mr16903736wmb.82.1477325223810; Mon, 24 Oct 2016 09:07:03 -0700 (PDT) Received: from localhost.localdomain ([105.146.229.54]) by smtp.gmail.com with ESMTPSA id h3sm20055144wjp.45.2016.10.24.09.07.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 09:07:03 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Date: Mon, 24 Oct 2016 17:06:43 +0100 Message-Id: <1477325206-24646-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477325206-24646-1-git-send-email-ard.biesheuvel@linaro.org> References: <1477325206-24646-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 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: 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 --- 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 Reviewed-by: Laszlo Ersek 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); } //