From: "Bob Feng" <bob.c.feng@intel.com>
To: "Chen, Christine" <yuwei.chen@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Rebecca Cran <rebecca@bsdio.com>,
"Gao, Liming" <gaoliming@byosoft.com.cn>
Subject: Re: [Patch V2 4/4] BaseTools: FMMT replace new free space fixing in replace
Date: Thu, 29 Jun 2023 06:58:22 +0000 [thread overview]
Message-ID: <PH7PR11MB58634338A6A07ADF6103B2E7C925A@PH7PR11MB5863.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230629033519.772-1-yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: Chen, Christine <yuwei.chen@intel.com>
Sent: Thursday, June 29, 2023 11:35 AM
To: devel@edk2.groups.io
Cc: Rebecca Cran <rebecca@bsdio.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [Patch V2 4/4] BaseTools: FMMT replace new free space fixing in replace
In FMMT replace function, when newffs size <= targetffs size, the new free space is calculated wrong as loss the pad data delta size.
That will cause invalid binary generated.
This patch fixes this issue.
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/Source/Python/FMMT/core/FvHandler.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/BaseTools/Source/Python/FMMT/core/FvHandler.py b/BaseTools/Source/Python/FMMT/core/FvHandler.py
index 49bbc35baa4d..7a6076033681 100644
--- a/BaseTools/Source/Python/FMMT/core/FvHandler.py
+++ b/BaseTools/Source/Python/FMMT/core/FvHandler.py
@@ -456,7 +456,7 @@ class FvHandler:
# Start free space calculating and moving process.
self.ModifyTest(TargetFv.Parent, Needed_Space)
else:
- New_Free_Space = self.TargetFfs.Data.Size - self.NewFfs.Data.Size
+ New_Free_Space = self.TargetFfs.Data.Size +
+ len(self.TargetFfs.Data.PadData) - self.NewFfs.Data.Size -
+ len(self.NewFfs.Data.PadData)
# If TargetFv already have free space, move the new free space into it.
if TargetFv.Data.Free_Space:
TargetFv.Child[-1].Data.Data += b'\xff' * New_Free_Space
--
2.27.0.windows.1
prev parent reply other threads:[~2023-06-29 6:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 3:35 [Patch V2 4/4] BaseTools: FMMT replace new free space fixing in replace Yuwei Chen
2023-06-29 6:58 ` Bob 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=PH7PR11MB58634338A6A07ADF6103B2E7C925A@PH7PR11MB5863.namprd11.prod.outlook.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