diff options
| author | Ray Ni <ray.ni@intel.com> | 2025-05-30 10:56:21 +0800 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-06-04 00:19:23 +0000 |
| commit | 24a80a59dbe02e4101303ff3acb3ae9fcd8ed7cb (patch) | |
| tree | 091430265b3978d2ee6873de47938e65342940fe /StandaloneMmPkg | |
| parent | d6d2f68e3801760646ac02117f2467382a310d61 (diff) | |
| download | edk2-24a80a59dbe02e4101303ff3acb3ae9fcd8ed7cb.tar.gz edk2-24a80a59dbe02e4101303ff3acb3ae9fcd8ed7cb.zip | |
StandaloneMmPkg/Core: Fix FV HOB loop by advancing with GET_NEXT_HOB
Previously, MmDispatchFvs could enter an infinite loop if a Firmware Volume
HOB with zero length was encountered, because GetNextHob() was called with
the same FvHob pointer repeatedly. This patch fixes the issue by passing
GET_NEXT_HOB(FvHob) to GetNextHob(), ensuring the loop advances to the next
HOB and preventing hangs.
Signed-off-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'StandaloneMmPkg')
| -rw-r--r-- | StandaloneMmPkg/Core/FwVol.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/StandaloneMmPkg/Core/FwVol.c b/StandaloneMmPkg/Core/FwVol.c index d5dfdacbf0..b89cb87841 100644 --- a/StandaloneMmPkg/Core/FwVol.c +++ b/StandaloneMmPkg/Core/FwVol.c @@ -255,9 +255,12 @@ MmDispatchFvs ( ZeroMem (mMmFv, sizeof (mMmFv));
- Index = 0;
- FvHob.Raw = GetHobList ();
- while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {
+ Index = 0;
+ for ( FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, GetHobList ())
+ ; FvHob.Raw != NULL
+ ; FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, GET_NEXT_HOB (FvHob))
+ )
+ {
if (Index == ARRAY_SIZE (mMmFv)) {
DEBUG ((
DEBUG_INFO,
@@ -302,8 +305,6 @@ MmDispatchFvs ( MmCoreFfsFindMmDriver (Fv, 0);
mMmFv[Index++] = Fv;
-
- FvHob.Raw = GET_NEXT_HOB (FvHob);
}
if (Index == 0) {
|
