public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Vin Xue <vinxue@outlook.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>
Subject: [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking
Date: Mon, 24 Jan 2022 17:10:11 +0800	[thread overview]
Message-ID: <SY4P282MB36487D3826AFD131362139D4C55E9@SY4P282MB3648.AUSP282.PROD.OUTLOOK.COM> (raw)

When creating FIT table, if a IBB FV (e.g. Security FV) is blow ACM FV
( e.g. Firmware Binaries FV), but the size of IBB FV is smaller than
ACM FV, it will cause overflow issue, unexpected split will happen.
Added a statement checking to avoid this issue.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Vin Xue <vinxue@outlook.com>
---
 Silicon/Intel/Tools/FitGen/FitGen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 290e688f6e..3cb8516757 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -759,7 +759,7 @@ CheckOverlap (
   INTN  Index;
 
   for (Index = 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index ++) {
-    if ((gFitTableContext.BiosModule[Index].Address <= Address) &&
+    if ((gFitTableContext.BiosModule[Index].Address <= Address) && (gFitTableContext.BiosModule[Index].Size >= Size) &&
         ((gFitTableContext.BiosModule[Index].Size - Size) >= (Address - gFitTableContext.BiosModule[Index].Address))) {
       UINT32  TempSize;
       INT32   SubIndex;
-- 
2.31.1.windows.1


             reply	other threads:[~2022-01-24  9:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24  9:10 Vin Xue [this message]
2022-02-22  5:54 ` [edk2-platform PATCH] Intel/FitGen: Fixed overflow issue when overlap checking Vin Xue

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=SY4P282MB36487D3826AFD131362139D4C55E9@SY4P282MB3648.AUSP282.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