]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MicrocodeUpdate: Fix GetImage API
authorJiewen Yao <jiewen.yao@intel.com>
Tue, 29 Nov 2016 07:54:57 +0000 (15:54 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Wed, 30 Nov 2016 12:13:58 +0000 (20:13 +0800)
Current GetImage API forgets to return data to caller.

Add code to fix it.

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
UefiCpuPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c

index 2b2d3acb6cfd5a6a4f0d25c5c09e84938b6566d9..2eb4ae4fbaab816399cabd1e699329dac478bd1f 100644 (file)
@@ -255,6 +255,16 @@ MicrocodeRead (
         TotalSize = MicrocodeEntryPoint->TotalSize;\r
       }\r
 \r
+      if (ImageIndex == Count + 1) {\r
+        if (*ImageSize < TotalSize) {\r
+          *ImageSize = TotalSize;\r
+          return EFI_BUFFER_TOO_SMALL;\r
+        }\r
+        *ImageSize = TotalSize;\r
+        CopyMem (Image, MicrocodeEntryPoint, TotalSize);\r
+        return EFI_SUCCESS;\r
+      }\r
+\r
     } else {\r
       //\r
       // It is the padding data between the microcode patches for microcode patches alignment.\r