public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API
@ 2016-11-29 13:31 Jiewen Yao
  2016-11-30  8:29 ` Fan, Jeff
  0 siblings, 1 reply; 2+ messages in thread
From: Jiewen Yao @ 2016-11-29 13:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jeff Fan

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>
---
 .../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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API
  2016-11-29 13:31 [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API Jiewen Yao
@ 2016-11-30  8:29 ` Fan, Jeff
  0 siblings, 0 replies; 2+ messages in thread
From: Fan, Jeff @ 2016-11-30  8:29 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org

Reviewed-by: Jeff Fan <jeff.fan@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.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-30  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 13:31 [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API Jiewen Yao
2016-11-30  8:29 ` Fan, Jeff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox