]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiHiiLib/HiiLib.c
Fix K8 issues in HiiDataBase
[mirror_edk2.git] / MdeModulePkg / Library / UefiHiiLib / HiiLib.c
index 06c345b128aef3cd23318d3fc1325ba07767fe2f..df73b7b3a19359b5f13f380b9e10b57750bb0473 100644 (file)
@@ -921,16 +921,17 @@ InternalHiiGetValueOfNumber (
 }\r
 \r
 /**\r
-  This function shares the same logic to parse ConfigAltResp string \r
-  for setting default value and validating current setting.\r
-\r
-  @param ConfigResp         \r
-  @param HiiPackageList     \r
-  @param PackageListLength  \r
-  @param VarGuid\r
-  @param VarName\r
+  This internal function parses IFR data to validate current setting.\r
+\r
+  @param ConfigResp         ConfigResp string contains the current setting.\r
+  @param HiiPackageList     Point to Hii package list.\r
+  @param PackageListLength  The length of the pacakge.\r
+  @param VarGuid            Guid of the buffer storage.\r
+  @param VarName            Name of the buffer storage.\r
   \r
-  @retval EFI_SUCCESS\r
+  @retval EFI_SUCCESS            The current setting is valid.\r
+  @retval EFI_OUT_OF_RESOURCES   The memory is not enough.\r
+  @retval EFI_INVALID_PARAMETER  The config string or the Hii package is invalid.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1214,7 +1215,7 @@ InternalHiiValidateCurrentSetting (
           }\r
           //\r
           // Find the matched VarStoreId to the input VarGuid and VarName\r
-          //            \r
+          //\r
           IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;\r
           if (CompareGuid ((EFI_GUID *) (VOID *) &IfrVarStore->Guid, VarGuid)) {\r
             VarStoreName = (CHAR8 *) IfrVarStore->Name;\r
@@ -1244,10 +1245,17 @@ InternalHiiValidateCurrentSetting (
           break;\r
         case EFI_IFR_ONE_OF_OP:\r
           //\r
-          // Check whether current value is the one of option. \r
+          // Check whether current value is the one of option.\r
           //\r
 \r
           //\r
+          // OneOf question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+          // \r
           // Check whether this question is for the requested varstore.\r
           //\r
           IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpHdr;\r
@@ -1298,6 +1306,13 @@ InternalHiiValidateCurrentSetting (
           // Check the current value is in the numeric range.\r
           //\r
 \r
+          //\r
+          // Numeric question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1381,6 +1396,14 @@ InternalHiiValidateCurrentSetting (
           // Check value is BOOLEAN type, only 0 and 1 is valid.\r
           //\r
 \r
+          //\r
+          // CheckBox question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1428,6 +1451,14 @@ InternalHiiValidateCurrentSetting (
           // Check current string length is less than maxsize\r
           //\r
 \r
+          //\r
+          // CheckBox question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1558,9 +1589,9 @@ Done:
 }\r
 \r
 /**\r
-  This function shares the same logic to parse ConfigAltResp string \r
-  for setting default value and validating current setting.\r
-  \r
+  This function parses the input ConfigRequest string and its matched IFR code\r
+  string for setting default value and validating current setting.\r
+\r
   1. For setting default action, Reset the default value specified by DefaultId \r
   to the driver configuration got by Request string.\r
   2. For validating current setting, Validate the current configuration \r