]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/HiiDB: Handle the "&READONLY" tag in <KeywordResp> correctly
authorDandan Bi <dandan.bi@intel.com>
Mon, 5 Sep 2016 06:55:49 +0000 (14:55 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 12 Sep 2016 10:26:18 +0000 (18:26 +0800)
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>
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c

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