Silicon/Intel/Tools/FitGen/FitGen.c | 31 ++++++++++++++++++++ Silicon/Intel/Tools/FitGen/FitGen.h | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-)
From: Jason1 Lin <jason1.lin@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3922
[Description]
CheckOverlap function would do incorrect split on the BiosModule which not happen overlap.
This would cause incorrect value locate in FIT entry record.
[Condition]
- This BiosModule base address is lower than input address.
- This BiosModule size is smaller than input size.
[Resolution]
- Do the check on BiosModule size and input size value to prevent possible
negative value.
Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Dakota Chiang <dakota.chiang@intel.com>
Cc: Vanessa Chuang <vanessa.chuang@intel.com>
---
Silicon/Intel/Tools/FitGen/FitGen.c | 31 ++++++++++++++++++++
Silicon/Intel/Tools/FitGen/FitGen.h | 2 +-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 577ce48b10..6af7f8e2d9 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -820,11 +820,42 @@ CheckOverlap (
IN UINT32 Address,
IN UINT32 Size
)
+/*++
+
+Routine Description:
+
+ Check whether the input address and size is overlap with any BiosModule.
+ If happen overlap, need to be deal with this case.
+ --- +--------------+ <------ BiosModule A Base +--------------+
+ | | | | |
+ | | | BiosModule |
+ | | | A |
+ | | | |
+ BiosModule A +--------------+ <------ [Input] Address ====> +--------------+
+ Size | | |
+ | | | [Input] Size
+ +--------------+ ------ +--------------+
+ | | | BiosModule |
+ | | | | B |
+ --- +--------------+ +--------------+
+
+Arguments:
+
+ Address - The address of the buffer that required to check.
+ Size - The size of the buffer that required to check.
+
+Returns:
+
+ None
+
+--*/
+
{
INTN Index;
for (Index = 0; Index < (INTN)gFitTableContext.BiosModuleNumber; Index ++) {
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;
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitGen/FitGen.h
index 80a1423ceb..769e2fda99 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.h
+++ b/Silicon/Intel/Tools/FitGen/FitGen.h
@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Utility version information
//
#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 66
+#define UTILITY_MINOR_VERSION 67
#define UTILITY_DATE __DATE__
//
--
2.37.0.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91181): https://edk2.groups.io/g/devel/message/91181
Mute This Topic: https://groups.io/mt/92249869/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.