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.web09.11341.1579007312815013070 for ; Tue, 14 Jan 2020 05:08:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y4nQpQUc; 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=1579007311; 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=iRRg34DPp3l5Y8lXmGxXHgqlTrb65oxlhdYEDPQvGc4=; b=Y4nQpQUcvOnVol96YTbnT/c6JhgjP6H2aBElFcK8NS5UiHpaenTOzrswivCzQco0d5SsHH x6mAw56qAQcHdVQFWk8Bq2l5A+dSgwlcXnl7JyM60LQlvSd/ukBQFzzAIGpeajcPGqeRiV EljI6MCg3Lvas5FelT33vxwdiPRr7IM= 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-405-cwE7HMgtNAisckwbYBPN0A-1; Tue, 14 Jan 2020 08:08:30 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2027210054E3; Tue, 14 Jan 2020 13:08:29 +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 B042886C63; Tue, 14 Jan 2020 13:08:27 +0000 (UTC) Subject: Re: [edk2-devel] [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN 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> From: "Laszlo Ersek" Message-ID: <15fdafea-a2d3-ea51-3d56-c41814cb01f2@redhat.com> Date: Tue, 14 Jan 2020 14:08:26 +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: <20200114085647.1796-1-dandan.bi@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: cwE7HMgtNAisckwbYBPN0A-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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? Thanks Laszlo