Reviewed-by: Jeff Fan <jeff....@intel.com>

-----Original Message-----
From: Yao, Jiewen 
Sent: Tuesday, November 29, 2016 9:32 PM
To: edk2-devel@lists.01.org
Cc: Fan, Jeff
Subject: [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API

Current GetImage API forgets to return data to caller.

Add code to fix it.

Cc: Jeff Fan <jeff....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen....@intel.com>
---
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c       | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c 
b/UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
index 2b2d3ac..2eb4ae4 100644
--- a/UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
+++ b/UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
@@ -255,6 +255,16 @@ MicrocodeRead (
         TotalSize = MicrocodeEntryPoint->TotalSize;
       }
 
+      if (ImageIndex == Count + 1) {
+        if (*ImageSize < TotalSize) {
+          *ImageSize = TotalSize;
+          return EFI_BUFFER_TOO_SMALL;
+        }
+        *ImageSize = TotalSize;
+        CopyMem (Image, MicrocodeEntryPoint, TotalSize);
+        return EFI_SUCCESS;
+      }
+
     } else {
       //
       // It is the padding data between the microcode patches for microcode 
patches alignment.
-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to