public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Tian, Feng" <feng.tian@intel.com>
To: "Yao, Jiewen" <jiewen.yao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Dong, Eric" <eric.dong@intel.com>, "Tian, Feng" <feng.tian@intel.com>
Subject: Re: [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue.
Date: Fri, 30 Sep 2016 02:49:36 +0000	[thread overview]
Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E24909@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1475203346-16788-1-git-send-email-jiewen.yao@intel.com>

Reviewed-by: Feng Tian <feng.tian@Intel.com>

Thanks
Feng

-----Original Message-----
From: Yao, Jiewen 
Sent: Friday, September 30, 2016 10:42 AM
To: edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue.

Current PeiCdExpress driver will return capsule size to be block aligned.
It will fail if we check the capsuleImageSize field.

The patch correct the returned capsule size.

Tested-by: Eric Dong <eric.dong@intel.com>

Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c | 9 +++++----  MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c
index f78118a..371ab73 100644
--- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c
+++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c
@@ -1,7 +1,7 @@
 /** @file
   Source file for CD recovery PEIM
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials  are licensed and made available under the terms and conditions @@ -477,13 +477,14 @@ RetrieveCapsuleFileFromRoot (
     }
 
     PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleStartLBA = FileRecord->LocationOfExtent[0];
-    PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize =
+    
+ PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleBlockAligne
+ dSize =
       (
         FileRecord->DataLength[0] /
         PEI_CD_BLOCK_SIZE +
         1
       ) *
       PEI_CD_BLOCK_SIZE;
+    PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize = 
+ FileRecord->DataLength[0];
 
     return EFI_SUCCESS;
   }
@@ -659,7 +660,7 @@ LoadRecoveryCapsule (
                           BlockIo2Ppi,
                           PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
                           PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
-                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,
+                          PrivateData->CapsuleData[CapsuleInstance - 
+ 1].CapsuleBlockAlignedSize,
                           Buffer
                           );
   } else {
@@ -668,7 +669,7 @@ LoadRecoveryCapsule (
                           BlockIoPpi,
                           PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
                           PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
-                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,
+                          PrivateData->CapsuleData[CapsuleInstance - 
+ 1].CapsuleBlockAlignedSize,
                           Buffer
                           );
   }
diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h
index 5ca2672..91f34dc 100644
--- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h
+++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h
@@ -66,6 +66,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 typedef struct {
   UINTN                           CapsuleStartLBA;
   UINTN                           CapsuleSize;
+  UINTN                           CapsuleBlockAlignedSize;
   UINTN                           IndexBlock;
   EFI_PEI_RECOVERY_BLOCK_IO_PPI   *BlockIo;
   EFI_PEI_RECOVERY_BLOCK_IO2_PPI  *BlockIo2;
--
2.7.4.windows.1



      reply	other threads:[~2016-09-30  2:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30  2:42 [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue Jiewen Yao
2016-09-30  2:49 ` Tian, Feng [this message]

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=7F1BAD85ADEA444D97065A60D2E97EE566E24909@SHSMSX101.ccr.corp.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