summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2024-07-26 13:52:42 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-03 07:30:55 +0000
commitd2e8118461ef82c975d9e1ce3855a2b9d44fa719 (patch)
tree6d64655f220a44fb7ba5381116a08880921f5075
parente73ec569429ba72fbb6829518d6c192b4cd3346f (diff)
downloadedk2-d2e8118461ef82c975d9e1ce3855a2b9d44fa719.zip
edk2-d2e8118461ef82c975d9e1ce3855a2b9d44fa719.tar.gz
edk2-d2e8118461ef82c975d9e1ce3855a2b9d44fa719.tar.bz2
StandaloneMmPkg: CodeQL Fixes.
Makes changes to comply with alerts raised by CodeQL. Most of the issues here fall into the following two categories: 1. Potential use of uninitialized pointer 2. Inconsistent integer width used in loop comparison Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
-rw-r--r--StandaloneMmPkg/Core/Dispatcher.c5
-rw-r--r--StandaloneMmPkg/Library/FvLib/FvLib.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/StandaloneMmPkg/Core/Dispatcher.c b/StandaloneMmPkg/Core/Dispatcher.c
index b9fe323..e55fdba 100644
--- a/StandaloneMmPkg/Core/Dispatcher.c
+++ b/StandaloneMmPkg/Core/Dispatcher.c
@@ -655,7 +655,10 @@ FvIsBeingProcessed (
DEBUG ((DEBUG_INFO, "FvIsBeingProcessed - 0x%08x\n", FwVolHeader));
KnownFwVol = AllocatePool (sizeof (KNOWN_FWVOL));
- ASSERT (KnownFwVol != NULL);
+ if (KnownFwVol == NULL) {
+ ASSERT (FALSE);
+ return;
+ }
KnownFwVol->Signature = KNOWN_FWVOL_SIGNATURE;
KnownFwVol->FwVolHeader = FwVolHeader;
diff --git a/StandaloneMmPkg/Library/FvLib/FvLib.c b/StandaloneMmPkg/Library/FvLib/FvLib.c
index e0f344a..2faa7cd 100644
--- a/StandaloneMmPkg/Library/FvLib/FvLib.c
+++ b/StandaloneMmPkg/Library/FvLib/FvLib.c
@@ -167,7 +167,7 @@ FfsFindNextFile (
FileOffset = (UINT32)((UINT8 *)FfsFileHeader - (UINT8 *)FwVolHeader);
- while (FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
+ while ((UINT64)FileOffset < (FvLength - sizeof (EFI_FFS_FILE_HEADER))) {
//
// Get FileState which is the highest bit of the State
//