https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6d97d8d2e15d9db634a21…
commit 6d97d8d2e15d9db634a2188d0f17983d74ea156c
Author: Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Fri Dec 18 15:24:09 2020 +0100
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Feb 3 09:41:22 2021 +0100
[NTOS:CC] Fix some tests, complain where the current implementation won't let us
do the right thing
---
ntoskrnl/cc/pin.c | 9 ++++++++-
ntoskrnl/cc/view.c | 6 ------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index 0d5642b9932..597468f6fd7 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -225,9 +225,13 @@ CcpPinData(
BOOLEAN Result;
VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
- /* This seems to be valid, according to KMTests */
+
if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
+ {
+ /* Complain loudly, we shoud pin the whole range */
+ DPRINT1("TRUNCATING DATA PIN FROM %lu to %lu!\n", Length,
VACB_MAPPING_GRANULARITY - VacbOffset);
Length = VACB_MAPPING_GRANULARITY - VacbOffset;
+ }
KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
NewBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, TRUE);
@@ -353,7 +357,10 @@ CcMapData (
VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
/* KMTests seem to show that it is allowed to call accross mapping granularity */
if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
+ {
+ DPRINT1("TRUNCATING DATA MAP FROM %lu to %lu!\n", Length,
VACB_MAPPING_GRANULARITY - VacbOffset);
Length = VACB_MAPPING_GRANULARITY - VacbOffset;
+ }
KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, FALSE);
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c
index ae6464f2b58..3952986dc44 100644
--- a/ntoskrnl/cc/view.c
+++ b/ntoskrnl/cc/view.c
@@ -572,12 +572,6 @@ CcRosCreateVacb (
DPRINT("CcRosCreateVacb()\n");
- if (FileOffset >= SharedCacheMap->SectionSize.QuadPart)
- {
- *Vacb = NULL;
- return STATUS_INVALID_PARAMETER;
- }
-
current = ExAllocateFromNPagedLookasideList(&VacbLookasideList);
current->BaseAddress = NULL;
current->Valid = FALSE;