]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg Variable: Add the check for PcdFlashNvStorageVariableSize <= PcdFlashNvSt...
authorStar Zeng <star.zeng@intel.com>
Thu, 11 Jul 2013 08:18:56 +0000 (08:18 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 11 Jul 2013 08:18:56 +0000 (08:18 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14464 6f19259b-4bc3-4df7-8a09-765794883524

SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableDxe.c
SecurityPkg/VariableAuthenticated/RuntimeDxe/VariableSmm.c

index ef53a96144de0a37f0158332438538cc0bd03545..f1ba9c18f0d18cdeee6c9bf5f745bec0ef7f1004 100644 (file)
@@ -3,7 +3,7 @@
   and volatile storage space and install variable architecture protocol.\r
 \r
 Copyright (C) 2013, Red Hat, Inc.\r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -337,6 +337,7 @@ FtwNotificationEvent (
   UINT64                                  Length;\r
   EFI_PHYSICAL_ADDRESS                    VariableStoreBase;\r
   UINT64                                  VariableStoreLength;\r
+  UINTN                                   FtwMaxBlockSize;\r
 \r
   //\r
   // Ensure FTW protocol is installed.\r
@@ -346,6 +347,11 @@ FtwNotificationEvent (
     return ;\r
   }\r
 \r
+  Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);\r
+  if (!EFI_ERROR (Status)) {\r
+    ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);\r
+  }\r
+\r
   //\r
   // Find the proper FVB protocol for variable.\r
   //\r
index 0be4f254d788e848b7838d6b97c47f29120e741e..eaef8d182c8a49f7361d11ae075b1764dce31e46 100644 (file)
@@ -797,6 +797,7 @@ SmmFtwNotificationEvent (
   EFI_SMM_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *FvbProtocol;\r
   EFI_SMM_FAULT_TOLERANT_WRITE_PROTOCOL   *FtwProtocol;\r
   EFI_PHYSICAL_ADDRESS                    NvStorageVariableBase;\r
+  UINTN                                   FtwMaxBlockSize;\r
   \r
   if (mVariableModuleGlobal->FvbInstance != NULL) {\r
     return EFI_SUCCESS;\r
@@ -810,6 +811,11 @@ SmmFtwNotificationEvent (
     return Status;\r
   }\r
 \r
+  Status = FtwProtocol->GetMaxBlockSize (FtwProtocol, &FtwMaxBlockSize);\r
+  if (!EFI_ERROR (Status)) {\r
+    ASSERT (PcdGet32 (PcdFlashNvStorageVariableSize) <= FtwMaxBlockSize);\r
+  }\r
+\r
   //\r
   // Find the proper FVB protocol for variable.\r
   //\r