From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 5BDB881E06 for ; Wed, 30 Nov 2016 00:29:59 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 30 Nov 2016 00:29:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,573,1473145200"; d="scan'208";a="197319600" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 30 Nov 2016 00:29:58 -0800 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 30 Nov 2016 00:29:58 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 30 Nov 2016 00:29:58 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.142]) with mapi id 14.03.0248.002; Wed, 30 Nov 2016 16:29:57 +0800 From: "Fan, Jeff" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] UefiCpuPkg/MicrocodeUpdate: Fix GetImage API Thread-Index: AQHSSkT0PJyB+NOwi0KXnL57IQTlFaDxMziA Date: Wed, 30 Nov 2016 08:29:56 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2EC46E@shsmsx102.ccr.corp.intel.com> References: <1480426299-65308-1-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1480426299-65308-1-git-send-email-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGFlZjMwZDQtN2IzYy00NzQ2LWJhOGQtZjIyMThlNWUyNWNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Imh4b2c0N2hQRVlVb25oYjkzN2hWcFlKY2F5aVlSTkFcLzd5VXNrcmtORGVZPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: Wed, 30 Nov 2016 08:29:59 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jeff Fan -----Original Message----- From: Yao, Jiewen=20 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 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 =3D MicrocodeEntryPoint->TotalSize; } =20 + if (ImageIndex =3D=3D Count + 1) { + if (*ImageSize < TotalSize) { + *ImageSize =3D TotalSize; + return EFI_BUFFER_TOO_SMALL; + } + *ImageSize =3D TotalSize; + CopyMem (Image, MicrocodeEntryPoint, TotalSize); + return EFI_SUCCESS; + } + } else { // // It is the padding data between the microcode patches for microcod= e patches alignment. --=20 2.7.4.windows.1