From 8567300ae4047da0891d62eedf50d407a23c5203 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 18 May 2009 12:12:56 +0000 Subject: Fix K8 issues in HiiDataBase git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8325 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 59 ++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'MdeModulePkg/Library/UefiHiiLib') diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index 06c345b..df73b7b 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -921,16 +921,17 @@ InternalHiiGetValueOfNumber ( } /** - This function shares the same logic to parse ConfigAltResp string - for setting default value and validating current setting. - - @param ConfigResp - @param HiiPackageList - @param PackageListLength - @param VarGuid - @param VarName + This internal function parses IFR data to validate current setting. + + @param ConfigResp ConfigResp string contains the current setting. + @param HiiPackageList Point to Hii package list. + @param PackageListLength The length of the pacakge. + @param VarGuid Guid of the buffer storage. + @param VarName Name of the buffer storage. - @retval EFI_SUCCESS + @retval EFI_SUCCESS The current setting is valid. + @retval EFI_OUT_OF_RESOURCES The memory is not enough. + @retval EFI_INVALID_PARAMETER The config string or the Hii package is invalid. **/ EFI_STATUS EFIAPI @@ -1214,7 +1215,7 @@ InternalHiiValidateCurrentSetting ( } // // Find the matched VarStoreId to the input VarGuid and VarName - // + // IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr; if (CompareGuid ((EFI_GUID *) (VOID *) &IfrVarStore->Guid, VarGuid)) { VarStoreName = (CHAR8 *) IfrVarStore->Name; @@ -1244,10 +1245,17 @@ InternalHiiValidateCurrentSetting ( break; case EFI_IFR_ONE_OF_OP: // - // Check whether current value is the one of option. + // Check whether current value is the one of option. // // + // OneOf question is not in IFR Form. This IFR form is not valid. + // + if (IfrVarStore == NULL) { + Status = EFI_INVALID_PARAMETER; + goto Done; + } + // // Check whether this question is for the requested varstore. // IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpHdr; @@ -1299,6 +1307,13 @@ InternalHiiValidateCurrentSetting ( // // + // Numeric question is not in IFR Form. This IFR form is not valid. + // + if (IfrVarStore == NULL) { + Status = EFI_INVALID_PARAMETER; + goto Done; + } + // // Check whether this question is for the requested varstore. // IfrNumeric = (EFI_IFR_NUMERIC *) IfrOpHdr; @@ -1382,6 +1397,14 @@ InternalHiiValidateCurrentSetting ( // // + // CheckBox question is not in IFR Form. This IFR form is not valid. + // + if (IfrVarStore == NULL) { + Status = EFI_INVALID_PARAMETER; + goto Done; + } + + // // Check whether this question is for the requested varstore. // IfrCheckBox = (EFI_IFR_CHECKBOX *) IfrOpHdr; @@ -1429,6 +1452,14 @@ InternalHiiValidateCurrentSetting ( // // + // CheckBox question is not in IFR Form. This IFR form is not valid. + // + if (IfrVarStore == NULL) { + Status = EFI_INVALID_PARAMETER; + goto Done; + } + + // // Check whether this question is for the requested varstore. // IfrString = (EFI_IFR_STRING *) IfrOpHdr; @@ -1558,9 +1589,9 @@ Done: } /** - This function shares the same logic to parse ConfigAltResp string - for setting default value and validating current setting. - + This function parses the input ConfigRequest string and its matched IFR code + string for setting default value and validating current setting. + 1. For setting default action, Reset the default value specified by DefaultId to the driver configuration got by Request string. 2. For validating current setting, Validate the current configuration -- cgit v1.1