From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 075D781D9D for ; Fri, 28 Oct 2016 07:23:05 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF58D61BA5; Fri, 28 Oct 2016 14:23:04 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-38.phx2.redhat.com [10.3.116.38]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9SEN3F3023831; Fri, 28 Oct 2016 10:23:04 -0400 To: Ard Biesheuvel , edk2-devel@ml01.01.org, leif.lindholm@linaro.org References: <1477651721-16958-1-git-send-email-ard.biesheuvel@linaro.org> <1477651721-16958-2-git-send-email-ard.biesheuvel@linaro.org> Cc: ryan.harkin@linaro.org From: Laszlo Ersek Message-ID: Date: Fri, 28 Oct 2016 16:23:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1477651721-16958-2-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 28 Oct 2016 14:23:05 +0000 (UTC) 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 14:23:05 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 10/28/16 12:48, 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)); Congratulations on the first genuine use of the now-central ARRAY_SIZE() macro! :) > > 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)); > } else { > *Value = '\0'; > } Right. > @@ -410,7 +411,7 @@ ArmFastbootPlatformOemCommand ( > { > CHAR16 CommandUnicode[65]; > > - AsciiStrToUnicodeStr (Command, CommandUnicode); > + AsciiStrToUnicodeStrS (Command, CommandUnicode, ARRAY_SIZE (CommandUnicode)); > > if (AsciiStrCmp (Command, "Demonstrate") == 0) { > DEBUG ((EFI_D_ERROR, "ARM OEM Fastboot command 'Demonstrate' received.\n")); > I knew ARRAY_SIZE() would be especially useful with these "safe string" functions! :) Reviewed-by: Laszlo Ersek