MdeModulePkg/HiiDB: Handle the "&READONLY" tag in <KeywordResp> correctly

This patch is to fix the incorrect logic when handling the "&READONLY" tag
in <KeywordResp>.
1. In UEFI spec, the "&READONLY" tag is in upper case, but using the lower
case in current codes by mistake.
2. The logic in checking the ReadOnly flag is not correct. Whether having
"&READONLY" tag must be consistent with the result of
"ExtractReadOnlyFromOpCode" function.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dandan Bi 2016-09-05 14:55:49 +08:00 committed by Star Zeng
parent 7d467158e0
commit 5654835bd1
1 changed files with 13 additions and 4 deletions

View File

@ -2907,11 +2907,11 @@ EfiConfigKeywordHandlerSetData (
StringPtr = NextStringPtr;
//
// 5. Find ReadOnly filter.
// 5. Find READONLY tag.
//
if ((StringPtr != NULL) && StrnCmp (StringPtr, L"&ReadOnly", StrLen (L"&ReadOnly")) == 0) {
if ((StringPtr != NULL) && StrnCmp (StringPtr, L"&READONLY", StrLen (L"&READONLY")) == 0) {
ReadOnly = TRUE;
StringPtr += StrLen (L"&ReadOnly");
StringPtr += StrLen (L"&READONLY");
} else {
ReadOnly = FALSE;
}
@ -2937,9 +2937,18 @@ EfiConfigKeywordHandlerSetData (
// 8. Check the readonly flag.
//
if (ExtractReadOnlyFromOpCode (OpCode) != ReadOnly) {
//
// Extracting readonly flag form opcode and extracting "READONLY" tag form KeywordString should have the same results.
// If not, the input KeywordString must be incorrect, return the error status to caller.
//
*ProgressErr = KEYWORD_HANDLER_INCOMPATIBLE_VALUE_DETECTED;
Status = EFI_INVALID_PARAMETER;
goto Done;
}
if (ReadOnly) {
*ProgressErr = KEYWORD_HANDLER_ACCESS_NOT_PERMITTED;
Status = EFI_ACCESS_DENIED;
goto Done;
goto Done;
}
//