[NTOSKRNL]

* Fix several logically dead code blocks. CIDs 731580, 731581 and 731582.
* Add a compile time assert to perform a preventive check as suggested by Thomas Faber.
CORE-6681

svn path=/trunk/; revision=60573
This commit is contained in:
Amine Khaldi 2013-10-07 12:33:03 +00:00
parent 599e34cb17
commit 44ec41cd68

View file

@ -115,6 +115,9 @@ static PFN_COUNT MiReservedSwapPages;
#define OFFSET_FROM_ENTRY(i) ((i) >> 11)
#define ENTRY_FROM_FILE_OFFSET(i, j) ((i) | ((j) << 11) | 0x400)
/* Make sure there can be only 16 paging files */
C_ASSERT(FILE_FROM_ENTRY(0xffffffff) < MAX_PAGING_FILES);
static BOOLEAN MmSwapSpaceMessage = FALSE;
/* FUNCTIONS *****************************************************************/
@ -239,11 +242,6 @@ MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
i = FILE_FROM_ENTRY(SwapEntry);
offset = OFFSET_FROM_ENTRY(SwapEntry);
if (i >= MAX_PAGING_FILES)
{
DPRINT1("Bad swap entry 0x%.8X\n", SwapEntry);
KeBugCheck(MEMORY_MANAGEMENT);
}
if (PagingFileList[i]->FileObject == NULL ||
PagingFileList[i]->FileObject->DeviceObject == NULL)
{
@ -301,11 +299,6 @@ MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_NUMBER Page)
i = FILE_FROM_ENTRY(SwapEntry);
offset = OFFSET_FROM_ENTRY(SwapEntry);
if (i >= MAX_PAGING_FILES)
{
DPRINT1("Bad swap entry 0x%.8X\n", SwapEntry);
KeBugCheck(MEMORY_MANAGEMENT);
}
if (PagingFileList[i]->FileObject == NULL ||
PagingFileList[i]->FileObject->DeviceObject == NULL)
{
@ -427,12 +420,6 @@ MmFreeSwapPage(SWAPENTRY Entry)
i = FILE_FROM_ENTRY(Entry);
off = OFFSET_FROM_ENTRY(Entry);
if (i >= MAX_PAGING_FILES)
{
DPRINT1("Bad swap entry 0x%.8X\n", Entry);
KeBugCheck(MEMORY_MANAGEMENT);
}
KeAcquireSpinLock(&PagingFileListLock, &oldIrql);
if (PagingFileList[i] == NULL)
{