From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4E96F1A1F52 for ; Thu, 8 Sep 2016 02:10:08 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP; 08 Sep 2016 02:10:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,298,1470726000"; d="scan'208";a="5941867" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga006.fm.intel.com with ESMTP; 08 Sep 2016 02:10:06 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Eric Dong Date: Thu, 8 Sep 2016 17:09:57 +0800 Message-Id: <1473325798-24284-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] MdeModulePkg/HiiDB: Handle the "&READONLY" tag in correctly X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2016 09:10:08 -0000 This patch is to fix the incorrect logic when handling the "&READONLY" tag in . 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 Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- .../Universal/HiiDatabaseDxe/ConfigKeywordHandler.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c index 6682319..10a901f 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c @@ -2905,15 +2905,15 @@ EfiConfigKeywordHandlerSetData ( goto Done; } 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; } // @@ -2935,13 +2935,22 @@ 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; } // // 9. Merge to the MultiKeywordResp string. // -- 1.9.5.msysgit.1