From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (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 46B7A81DB3 for ; Fri, 28 Oct 2016 08:02:22 -0700 (PDT) Received: by mail-yw0-x235.google.com with SMTP id u124so89185534ywg.3 for ; Fri, 28 Oct 2016 08:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xefK7Zk2r5w45kQqNW080zyfkwkeRdfWcKPM4PJv+Hc=; b=XCsp1s4oxiUq88V7jqCCDrcHz2UqJ8NHTE5VmyoXUoInMNn4Sth39TbQjv6fGM0jVg ZNfUx7pqX8ilrAmaXvMl0v3UsD3Ws2v/ptMYd5T5na1BtZGhLeaYaGgDsJXQVkYtwsW0 ed56F6o7eE1xXyot9c3sCXSN/t8HbRsPoset0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xefK7Zk2r5w45kQqNW080zyfkwkeRdfWcKPM4PJv+Hc=; b=Ihru3yVZb5SuYfa042+JmwVN13WOTcKeu+YyvjnRG4z7ZEnlBJFh+r3bGyEv2o/I8i WaR3YLDTA8bUG5p/lhBk+6sT5KLAUeLMdZlgWrGkuO8eWW79uvnBUzF+zrMNYOxv5c+Z xbEld4tC6QVcuIhxm9S0uzkeWaGglxMlumLdnDfdq6Oafz8K2rqPFVMK/66W+tfR8OYb rWEMR/NWpdTrcGi7QVN9+ZApfhL2b1QBgmBWvDhDnmfag8/PNzIEUVnnOT8rQjR8FWIf pg8WypOY2fz3OHn6D9pcY4t6n7OBxcJ40NudCooU/eCEISBa4q8wZBUe6DJesV8KZijz xV5Q== X-Gm-Message-State: ABUngvfBVhFhnLxhpBRqx/spS3rlsXUDzHM40GHQgbqakdS1k+wIPwOtT8TEYMdAJgabr1cBdD96uvsPPjvLqjx8 X-Received: by 10.107.25.11 with SMTP id 11mr10994323ioz.138.1477666941521; Fri, 28 Oct 2016 08:02:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.5.139 with HTTP; Fri, 28 Oct 2016 08:02:21 -0700 (PDT) In-Reply-To: <20161028144834.GU1161@bivouac.eciton.net> References: <1477651721-16958-1-git-send-email-ard.biesheuvel@linaro.org> <1477651721-16958-2-git-send-email-ard.biesheuvel@linaro.org> <20161028144834.GU1161@bivouac.eciton.net> From: Ard Biesheuvel Date: Fri, 28 Oct 2016 16:02:21 +0100 Message-ID: To: Leif Lindholm Cc: edk2-devel-01 , Laszlo Ersek , Ryan Harkin Subject: Re: [PATCH v2 1/2] ArmPlatformPkg/ArmVExpressFastBootDxe: eliminate 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 15:02:22 -0000 Content-Type: text/plain; charset=UTF-8 On 28 October 2016 at 15:48, Leif Lindholm wrote: > On Fri, Oct 28, 2016 at 11:48:40AM +0100, Ard Biesheuvel wrote: >> Get rid of functions that are no longer available when defining >> DISABLE_NEW_DEPRECATED_INTERFACES >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel >> --- >> ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c >> index 4d0811cc5eaf..64b25f8a8c45 100644 >> --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c >> +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressFastBootDxe/ArmVExpressFastBoot.c >> @@ -269,7 +269,7 @@ ArmFastbootPlatformInit ( >> >> // Copy handle and partition name >> Entry->PartitionHandle = AllHandles[LoopIndex]; >> - StrnCpy ( >> + CopyMem ( >> Entry->PartitionName, >> PartitionEntries[PartitionNode->PartitionNumber - 1].PartitionName, // Partition numbers start from 1. >> PARTITION_NAME_MAX_LENGTH >> @@ -320,7 +320,8 @@ ArmFastbootPlatformFlashPartition ( >> CHAR16 PartitionNameUnicode[60]; >> BOOLEAN PartitionFound; >> >> - AsciiStrToUnicodeStr (PartitionName, PartitionNameUnicode); >> + AsciiStrToUnicodeStrS (PartitionName, PartitionNameUnicode, >> + ARRAY_SIZE (PartitionNameUnicode)); >> >> PartitionFound = FALSE; >> Entry = (FASTBOOT_PARTITION_LIST *) GetFirstNode (&(mPartitionListHead)); >> @@ -396,7 +397,7 @@ ArmFastbootPlatformGetVar ( >> ) >> { >> if (AsciiStrCmp (Name, "product")) { >> - AsciiStrCpy (Value, FixedPcdGetPtr (PcdFirmwareVendor)); >> + AsciiStrCpyS (Value, 61, FixedPcdGetPtr (PcdFirmwareVendor)); > > I'm totally OK with the reason for hard-coding this, but could you add > the comment from the feedback on previous version?: > // FASTBOOT_COMMAND_MAX_LENGTH - 4 + NULL terminator > (Or if there's a better way of putting it.) > What if I decorate each entry point with the comment block from the associated protocol header file instead? (in a follow up patch) That is common practice in Tianocore anyway, and looks like this for this particular protocol method: /* If the variable referred to by Name exists, copy it (as a null-terminated string) into Value. If it doesn't exist, put the Empty string in Value. Variable names and values may not be larger than 60 bytes, excluding the terminal null character. This is a limitation of the Fastboot protocol. The Fastboot application will handle platform-nonspecific variables (Currently "version" is the only one of these.) @param[in] Name Null-terminated name of Fastboot variable to retrieve. @param[out] Value Caller-allocated buffer for null-terminated value of variable. @retval EFI_SUCCESS The variable was retrieved, or it doesn't exist. @retval EFI_DEVICE_ERROR There was an error looking up the variable. This does _not_ include the variable not existing. */