summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c')
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 34bc4a8e15..20eeebe54c 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -676,11 +676,12 @@ FindVariableInCache (
if (Entry->DataSize == 0) {
// Variable was deleted so return not found
return EFI_NOT_FOUND;
- } else if (Entry->DataSize != *DataSize) {
+ } else if (Entry->DataSize > *DataSize) {
// If the buffer is too small return correct size
*DataSize = Entry->DataSize;
return EFI_BUFFER_TOO_SMALL;
} else {
+ *DataSize = Entry->DataSize;
// Return the data
CopyMem (Data, Entry->Data, Entry->DataSize);
if (Attributes != NULL) {