* [PATCH] MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues
@ 2023-01-04 6:52 Ranbir Singh
0 siblings, 0 replies; only message in thread
From: Ranbir Singh @ 2023-01-04 6:52 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
The functions CoreConvertSpace and CoreAllocateSpace in
MdeModulePkg/Core/Dxe/Gcd/Gcd.c has
ASSERT (FALSE); at lines 755 and 1155 which gets hit when
Operation neither include GCD_MEMORY_SPACE_OPERATION nor include
GCD_IO_SPACE_OPERATION but this comes into play only in DEBUG mode.
In Release mode, the code continues to proceed in this undesirable
case with Map variable still set to NULL and hence dereferencing
"Map" will lead to CRASH.
It is safer to add a debug message in this scenario and return from
the function with EFI_INVALID_PARAMETER; The existing ASSERT may be
retained or may be deleted whatever is deemed more appropriate.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4219
Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 792cd2e0af..39fa2adf93 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -752,7 +752,9 @@ CoreConvertSpace (
CoreAcquireGcdIoLock ();
Map = &mGcdIoSpaceMap;
} else {
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
}
//
@@ -1152,7 +1154,9 @@ CoreAllocateSpace (
CoreAcquireGcdIoLock ();
Map = &mGcdIoSpaceMap;
} else {
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
ASSERT (FALSE);
+ return EFI_INVALID_PARAMETER;
}
Found = FALSE;
--
2.36.1.windows.1
[-- Attachment #2: Type: text/html, Size: 2447 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-04 6:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04 6:52 [PATCH] MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues Ranbir Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox