]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix a bug in variable driver cache mechanism:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Oct 2007 08:49:20 +0000 (08:49 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Oct 2007 08:49:20 +0000 (08:49 +0000)
It should return EFI_SUCCESS and update the output buffer size if the input buffer is larger than actual variable contents.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4182 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index 34bc4a8e1522e5d9ce88694491192802d492a195..20eeebe54cc861f9a4068345394053c2864fd270 100644 (file)
@@ -676,11 +676,12 @@ FindVariableInCache (
         if (Entry->DataSize == 0) {\r
           // Variable was deleted so return not found\r
           return EFI_NOT_FOUND;\r
-        } else if (Entry->DataSize != *DataSize) {\r
+        } else if (Entry->DataSize > *DataSize) {\r
           // If the buffer is too small return correct size\r
           *DataSize = Entry->DataSize;\r
           return EFI_BUFFER_TOO_SMALL;\r
         } else {\r
+          *DataSize = Entry->DataSize;\r
           // Return the data\r
           CopyMem (Data, Entry->Data, Entry->DataSize);\r
           if (Attributes != NULL) {\r