From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7437481EB0 for ; Tue, 29 Nov 2016 05:31:46 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP; 29 Nov 2016 05:31:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,717,1473145200"; d="scan'208";a="36877339" Received: from binbinhe-mobl2.ccr.corp.intel.com (HELO jyao1-MOBL.ccr.corp.intel.com) ([10.254.209.67]) by fmsmga005.fm.intel.com with ESMTP; 29 Nov 2016 05:31:45 -0800 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Jeff Fan Date: Tue, 29 Nov 2016 21:31:39 +0800 Message-Id: <1480426299-65308-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 13:31:46 -0000 Current GetImage API forgets to return data to caller. Add code to fix it. Cc: Jeff Fan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- .../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