[edk2] [patch] MdeModulePkg/VarCheckHii: Update data type for variable "ArrayIndex"

Dandan Bi posted 1 patch 6 years, 3 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[edk2] [patch] MdeModulePkg/VarCheckHii: Update data type for variable "ArrayIndex"
Posted by Dandan Bi 6 years, 3 months ago
In some case the ArrayIndex with UINT16 may be not large enough to
hold the multiplication result of HiiQuestion->VarOffset * 8;
So this patch update the data type to fix this potential issue.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
index 0db1383..debabb5 100644
--- a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
+++ b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
@@ -1,9 +1,9 @@
 /** @file
   Var Check Hii bin generation.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -513,11 +513,11 @@ MergeHiiQuestion (
   UINT64                            Maximum2;
   UINT64                            OneValue2;
   UINT8                             *Ptr;
   UINT8                             *Ptr1;
   UINT8                             *Ptr2;
-  UINT16                            ArrayIndex;
+  UINTN                             ArrayIndex;
 
   //
   // Hii Question from Hii Database has high priority.
   // Do not to merge Hii Question from Fv to Hii Question from Hii Database.
   //
@@ -1062,11 +1062,11 @@ ParseHiiQuestion (
   IN BOOLEAN                        FromFv,
   IN BOOLEAN                        StoredInBitField
   )
 {
   VAR_CHECK_HII_QUESTION_HEADER *HiiQuestion;
-  UINT16                        ArrayIndex;
+  UINTN                         ArrayIndex;
 
   //
   // Currently only OneOf, CheckBox and Numeric can be stored in bit field.
   //
   switch (IfrOpCodeHeader->OpCode) {
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [patch] MdeModulePkg/VarCheckHii: Update data type for variable "ArrayIndex"
Posted by Zeng, Star 6 years, 3 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Bi, Dandan 
Sent: Tuesday, January 9, 2018 3:25 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [patch] MdeModulePkg/VarCheckHii: Update data type for variable "ArrayIndex"

In some case the ArrayIndex with UINT16 may be not large enough to hold the multiplication result of HiiQuestion->VarOffset * 8; So this patch update the data type to fix this potential issue.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
index 0db1383..debabb5 100644
--- a/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
+++ b/MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGen.c
@@ -1,9 +1,9 @@
 /** @file
   Var Check Hii bin generation.
 
-Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at  http://opensource.org/licenses/bsd-license.php
 
@@ -513,11 +513,11 @@ MergeHiiQuestion (
   UINT64                            Maximum2;
   UINT64                            OneValue2;
   UINT8                             *Ptr;
   UINT8                             *Ptr1;
   UINT8                             *Ptr2;
-  UINT16                            ArrayIndex;
+  UINTN                             ArrayIndex;
 
   //
   // Hii Question from Hii Database has high priority.
   // Do not to merge Hii Question from Fv to Hii Question from Hii Database.
   //
@@ -1062,11 +1062,11 @@ ParseHiiQuestion (
   IN BOOLEAN                        FromFv,
   IN BOOLEAN                        StoredInBitField
   )
 {
   VAR_CHECK_HII_QUESTION_HEADER *HiiQuestion;
-  UINT16                        ArrayIndex;
+  UINTN                         ArrayIndex;
 
   //
   // Currently only OneOf, CheckBox and Numeric can be stored in bit field.
   //
   switch (IfrOpCodeHeader->OpCode) {
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel