Good catch and I agree the code change. Only one minor comment.
Please reduce the title length to <= 72 chars as I know it is requirement for 
patch check (PatchCheck.py in BaseTools) and push to server.

Thanks,
Star
-----Original Message-----
From: cinnamon shia [mailto:[email protected]] 
Sent: Friday, May 11, 2018 12:18 PM
To: [email protected]
Cc: [email protected]; Zeng, Star <[email protected]>; cinnamon shia 
<[email protected]>; Ansen Huang <[email protected]>
Subject: [PATCH 1/2] MdeModulePkg Variable: Failed to set a variable if the 
remaining size is equal to the variable data size.

Fix the issue that failed to update or add a UEFI variable if the remaining 
size is equal to the data size
of the variable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <[email protected]>
Signed-off-by: Ansen Huang <[email protected]>
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 6caf603b3d..7303681aaa 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -17,7 +17,7 @@
   integer overflow. It should also check attribute to avoid authentication 
bypass.
 
 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
-(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
+(C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -288,7 +288,7 @@ UpdateVariableStore (
       DataPtr += mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase;
     }
 
-    if ((DataPtr + DataSize) >= ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) 
FwVolHeader + FwVolHeader->FvLength))) {
+    if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) 
FwVolHeader + FwVolHeader->FvLength))) {
       return EFI_INVALID_PARAMETER;
     }
   } else {
@@ -301,7 +301,7 @@ UpdateVariableStore (
       DataPtr += mVariableModuleGlobal->VariableGlobal.VolatileVariableBase;
     }
 
-    if ((DataPtr + DataSize) >= ((UINTN) ((UINT8 *) VolatileBase + 
VolatileBase->Size))) {
+    if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + 
VolatileBase->Size))) {
       return EFI_INVALID_PARAMETER;
     }
 
-- 
2.16.1.windows.4

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to