public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: Jeff Fan <jeff.fan@intel.com>
Subject: [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API
Date: Tue, 29 Nov 2016 21:31:39 +0800	[thread overview]
Message-ID: <1480426299-65308-1-git-send-email-jiewen.yao@intel.com> (raw)

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



             reply	other threads:[~2016-11-29 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 13:31 Jiewen Yao [this message]
2016-11-30  8:29 ` [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API Fan, Jeff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480426299-65308-1-git-send-email-jiewen.yao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox