public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
@ 2020-01-14  8:56 Dandan Bi
  2020-01-14 12:58 ` Liming Gao
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dandan Bi @ 2020-01-14  8:56 UTC (permalink / raw)
  To: devel; +Cc: Brian R Haug, Liming Gao, Eric Dong

From: Brian R Haug <brian.r.haug@intel.com>

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 <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
---
 .../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.<BR>
+Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
 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;
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
  2020-01-14  8:56 [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN Dandan Bi
@ 2020-01-14 12:58 ` Liming Gao
  2020-01-14 13:08 ` [edk2-devel] " Laszlo Ersek
  2020-01-15  0:24 ` Dong, Eric
  2 siblings, 0 replies; 5+ messages in thread
From: Liming Gao @ 2020-01-14 12:58 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Haug, Brian R, Dong, Eric

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Tuesday, January 14, 2020 4:57 PM
> To: devel@edk2.groups.io
> Cc: Haug, Brian R <brian.r.haug@intel.com>; Gao, Liming <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
> 
> From: Brian R Haug <brian.r.haug@intel.com>
> 
> 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 <liming.gao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../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.<BR>
> +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
>  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;
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
  2020-01-14  8:56 [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN Dandan Bi
  2020-01-14 12:58 ` Liming Gao
@ 2020-01-14 13:08 ` Laszlo Ersek
  2020-01-14 13:09   ` Laszlo Ersek
  2020-01-15  0:24 ` Dong, Eric
  2 siblings, 1 reply; 5+ messages in thread
From: Laszlo Ersek @ 2020-01-14 13:08 UTC (permalink / raw)
  To: devel, dandan.bi; +Cc: Brian R Haug, Liming Gao, Eric Dong

Hi Dandan, Brian,

On 01/14/20 09:56, Dandan Bi wrote:
> From: Brian R Haug <brian.r.haug@intel.com>
>
> 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 <liming.gao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../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.<BR>
> +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
>  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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
  2020-01-14 13:08 ` [edk2-devel] " Laszlo Ersek
@ 2020-01-14 13:09   ` Laszlo Ersek
  0 siblings, 0 replies; 5+ messages in thread
From: Laszlo Ersek @ 2020-01-14 13:09 UTC (permalink / raw)
  To: devel, dandan.bi; +Cc: Brian R Haug, Liming Gao, Eric Dong

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 <brian.r.haug@intel.com>
>>
>> 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 <liming.gao@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
>> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
>> ---
>>  .../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.<BR>
>> +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
>>  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 <lersek@redhat.com>

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN
  2020-01-14  8:56 [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN Dandan Bi
  2020-01-14 12:58 ` Liming Gao
  2020-01-14 13:08 ` [edk2-devel] " Laszlo Ersek
@ 2020-01-15  0:24 ` Dong, Eric
  2 siblings, 0 replies; 5+ messages in thread
From: Dong, Eric @ 2020-01-15  0:24 UTC (permalink / raw)
  To: Bi, Dandan, devel@edk2.groups.io; +Cc: Haug, Brian R, Gao, Liming

Reviewed-by: Eric Dong <eric.dong@intel.com>

> -----Original Message-----
> From: Bi, Dandan
> Sent: Tuesday, January 14, 2020 4:57 PM
> To: devel@edk2.groups.io
> Cc: Haug, Brian R <brian.r.haug@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: [patch] MdeModulePkg/Setup: Update opcode number variable
> type to UINTN
> 
> From: Brian R Haug <brian.r.haug@intel.com>
> 
> 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 <liming.gao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Brian R Haug <brian.r.haug@intel.com>
> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../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.<BR>
> +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>
>  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;
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-15  0:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-14  8:56 [patch] MdeModulePkg/Setup: Update opcode number variable type to UINTN Dandan Bi
2020-01-14 12:58 ` Liming Gao
2020-01-14 13:08 ` [edk2-devel] " Laszlo Ersek
2020-01-14 13:09   ` Laszlo Ersek
2020-01-15  0:24 ` Dong, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox