summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/Dxe/Gcd
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-26 08:53:27 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-26 08:53:27 +0000
commitd2fbaaab17945b59ca66bcd2f72e26ba3361e1d0 (patch)
tree29fa29d32bdbd1a34dd97ed53da9496478063a7f /MdeModulePkg/Core/Dxe/Gcd
parent4ccd9566c12b90ed60c38ca7cf4156ee83861db1 (diff)
downloadedk2-d2fbaaab17945b59ca66bcd2f72e26ba3361e1d0.tar.gz
edk2-d2fbaaab17945b59ca66bcd2f72e26ba3361e1d0.tar.bz2
edk2-d2fbaaab17945b59ca66bcd2f72e26ba3361e1d0.zip
Add more code robustness check for modules under MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10108 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/Gcd')
-rw-r--r--MdeModulePkg/Core/Dxe/Gcd/Gcd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 6ac093162e..32a56e7660 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -3,7 +3,7 @@
The GCD services are used to manage the memory and I/O regions that
are accessible to the CPU that is executing the DXE core.
-Copyright (c) 2006 - 2008, Intel Corporation. <BR>
+Copyright (c) 2006 - 2010, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -599,6 +599,7 @@ CoreConvertSpace (
goto Done;
}
+ ASSERT (StartLink != NULL && EndLink != NULL);
//
// Verify that the list of descriptors are unallocated non-existent memory.
@@ -684,6 +685,7 @@ CoreConvertSpace (
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+ ASSERT (TopEntry != NULL && BottomEntry != NULL);
if (Operation == GCD_SET_ATTRIBUTES_MEMORY_OPERATION) {
//
@@ -692,7 +694,7 @@ CoreConvertSpace (
CpuArchAttributes = ConverToCpuArchAttributes (Attributes);
if ( CpuArchAttributes != INVALID_CPU_ARCH_ATTRIBUTES ) {
Status = CoreLocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&CpuArch);
- if (EFI_ERROR (Status)) {
+ if (EFI_ERROR (Status) || CpuArch == NULL) {
Status = EFI_ACCESS_DENIED;
goto Done;
}
@@ -926,6 +928,7 @@ CoreAllocateSpace (
Status = EFI_NOT_FOUND;
goto Done;
}
+ ASSERT (StartLink != NULL && EndLink != NULL);
//
// Verify that the list of descriptors are unallocated memory matching GcdMemoryType.
@@ -1009,6 +1012,7 @@ CoreAllocateSpace (
Status = EFI_NOT_FOUND;
goto Done;
}
+ ASSERT (StartLink != NULL && EndLink != NULL);
Link = StartLink;
//
@@ -1044,6 +1048,7 @@ CoreAllocateSpace (
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+ ASSERT (TopEntry != NULL && BottomEntry != NULL);
//
// Convert/Insert the list of descriptors from StartLink to EndLink
@@ -1330,6 +1335,7 @@ CoreGetMemorySpaceDescriptor (
if (EFI_ERROR (Status)) {
Status = EFI_NOT_FOUND;
} else {
+ ASSERT (StartLink != NULL && EndLink != NULL);
//
// Copy the contents of the found descriptor into Descriptor
//
@@ -1609,6 +1615,7 @@ CoreGetIoSpaceDescriptor (
if (EFI_ERROR (Status)) {
Status = EFI_NOT_FOUND;
} else {
+ ASSERT (StartLink != NULL && EndLink != NULL);
//
// Copy the contents of the found descriptor into Descriptor
//