From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.11173.1579007386340364226 for ; Tue, 14 Jan 2020 05:09:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SpfLIzRd; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579007385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rykTVTG5KmzYr6CjuqYUIAYYkGY++cq9MdMlh2iQymg=; b=SpfLIzRdpjlyk/zfik/ScHIapL8xpT7Q8x5z6LNj0tIOduQmqYJBZZ3WkU9KkbovIDGJ4k pz3Ly1/d4djEYa6Imh2UGhipLaB0ad4WViC4rN6UFBSb77K35Vdb4mfVMYkaG74WPy8GTn VV7NVOTTvb4MYe4VbmlfRIUaOWtBCPI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-339-VwMPTy6GPcOZtJ3piWDCbA-1; Tue, 14 Jan 2020 08:09:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5867F107ACC7; Tue, 14 Jan 2020 13:09:40 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-66.ams2.redhat.com [10.36.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0863F5C219; Tue, 14 Jan 2020 13:09:38 +0000 (UTC) Subject: Re: [edk2-devel] [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN From: "Laszlo Ersek" To: devel@edk2.groups.io, dandan.bi@intel.com Cc: Brian R Haug , Liming Gao , Eric Dong References: <20200114085647.1796-1-dandan.bi@intel.com> <15fdafea-a2d3-ea51-3d56-c41814cb01f2@redhat.com> Message-ID: <7a53dfb7-c014-c105-9189-0aa68c97a117@redhat.com> Date: Tue, 14 Jan 2020 14:09:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <15fdafea-a2d3-ea51-3d56-c41814cb01f2@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: VwMPTy6GPcOZtJ3piWDCbA-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 01/14/20 14:08, Laszlo Ersek wrote: > Hi Dandan, Brian, > > On 01/14/20 09:56, Dandan Bi wrote: >> From: Brian R Haug >> >> Update data type of variables which save the opcode numbers >> to UINTN, in case some configuration module has lots of >> configuration items. >> >> Cc: Liming Gao >> Cc: Eric Dong >> Signed-off-by: Brian R Haug >> Reviewed-by: Dandan Bi >> --- >> .../Universal/SetupBrowserDxe/IfrParse.c | 18 +++++++++--------- >> 1 file changed, 9 insertions(+), 9 deletions(-) >> >> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> index 891b95cf9f..edb6a0fc4c 100644 >> --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> @@ -1,17 +1,17 @@ >> /** @file >> Parser for IFR binary encoding. >> >> -Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
>> +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.
>> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> >> #include "Setup.h" >> >> -UINT16 mStatementIndex; >> -UINT16 mExpressionOpCodeIndex; >> +UINTN mStatementIndex; >> +UINTN mExpressionOpCodeIndex; >> EFI_QUESTION_ID mUsedQuestionId; >> extern LIST_ENTRY gBrowserStorageList; >> /** >> Initialize Statement header members. >> >> @@ -1104,16 +1104,16 @@ IsUnKnownOpCode ( >> >> **/ >> VOID >> CountOpCodes ( >> IN FORM_BROWSER_FORMSET *FormSet, >> - IN OUT UINT16 *NumberOfStatement, >> - IN OUT UINT16 *NumberOfExpression >> + OUT UINTN *NumberOfStatement, >> + OUT UINTN *NumberOfExpression >> ) >> { >> - UINT16 StatementCount; >> - UINT16 ExpressionCount; >> + UINTN StatementCount; >> + UINTN ExpressionCount; >> UINT8 *OpCodeData; >> UINTN Offset; >> UINTN OpCodeLen; >> >> Offset = 0; >> @@ -1167,12 +1167,12 @@ ParseOpCodes ( >> FORMSET_STORAGE *Storage; >> FORMSET_DEFAULTSTORE *DefaultStore; >> QUESTION_DEFAULT *CurrentDefault; >> QUESTION_OPTION *CurrentOption; >> UINT8 Width; >> - UINT16 NumberOfStatement; >> - UINT16 NumberOfExpression; >> + UINTN NumberOfStatement; >> + UINTN NumberOfExpression; >> EFI_IMAGE_ID *ImageId; >> BOOLEAN SuppressForQuestion; >> BOOLEAN SuppressForOption; >> UINT16 DepthOfDisable; >> BOOLEAN OpCodeDisabled; >> > > I think this patch is incomplete. While the following statements will > adapt automatically: > > FormSet->StatementBuffer = AllocateZeroPool (NumberOfStatement * sizeof (FORM_BROWSER_STATEMENT)); > > FormSet->ExpressionBuffer = AllocateZeroPool (NumberOfExpression * sizeof (EXPRESSION_OPCODE)); > > I think we'll need to update the indexing into those arrays explicitly. > Namely, > >> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> index 891b95cf9fb8..9b241ded8cdc 100644 >> --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c >> @@ -8,8 +8,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >> >> #include "Setup.h" >> >> -UINT16 mStatementIndex; >> -UINT16 mExpressionOpCodeIndex; >> +UINTN mStatementIndex; >> +UINTN mExpressionOpCodeIndex; >> EFI_QUESTION_ID mUsedQuestionId; >> extern LIST_ENTRY gBrowserStorageList; >> /** > > Do you agree? Aargh, I missed that that's exactly how the patch starts! Sorry about the noise :) Reviewed-by: Laszlo Ersek Thanks Laszlo