summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Application/VariableInfo
diff options
context:
space:
mode:
authorAaron Pop <aaronpop@microsoft.com>2025-10-22 21:33:02 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-08-05 06:07:16 +0300
commitdfd0edeb4e71f01f83cf9aa53285db4f14e5487d (patch)
treeeadf849879e2616b236bb70f85721a25e621d035 /MdeModulePkg/Application/VariableInfo
parent699382e3429a4ecd3ccd58d333f413e14bb10edc (diff)
downloadedk2-dfd0edeb4e71f01f83cf9aa53285db4f14e5487d.tar.xz
MdeModulePkg: Fix missing NULL tests
https://github.com/github/codeql/blob/codeql-cli-2.7.3/cpp/ql/src/Critical/MissingNullTest.qhelp For items which allocate memory, or get a pointer from another structure, it is important to validate that the pointers are not null before they are dereferenced. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Diffstat (limited to 'MdeModulePkg/Application/VariableInfo')
-rw-r--r--MdeModulePkg/Application/VariableInfo/VariableInfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c b/MdeModulePkg/Application/VariableInfo/VariableInfo.c
index 3dee41eb4b..13c4acc2f2 100644
--- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c
+++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c
@@ -131,7 +131,12 @@ PrintInfoFromSmm (
Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
}
- ASSERT (CommBuffer != NULL);
+ if (CommBuffer == NULL) {
+ DEBUG ((DEBUG_ERROR, "Warning: No SMM communication buffer found!\n"));
+ ASSERT (CommBuffer != NULL);
+ return EFI_NOT_FOUND;
+ }
+
ZeroMem (CommBuffer, RealCommSize);
Print (L"SMM Driver Non-Volatile Variables:\n");