https://git.reactos.org/?p=reactos.git;a=commitdiff;h=371aba1abee3f872ee9f1…
commit 371aba1abee3f872ee9f146015f9db59ec6297df
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Jan 13 21:27:29 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Jan 13 21:30:37 2018 +0100
[NTOSKRNL] When mapping data in CcMapData(), don't truncate offset to ULONG.
This would affect reads/writes on large volumes where offset is higher than what a ULONG can hold.
This really nasty bug was hitting CcMapData() but also CcPinRead() (due to the nature of its implementation)
and both were returning garbage data under certain circumstances with Ext2Fsd.
This should (I hope!) help some other FSDs to work better in ROS.
CORE-12456
---
ntoskrnl/cc/pin.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index 6a0d6758ca..0241927f95 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -33,19 +33,19 @@ CcMapData (
OUT PVOID *pBcb,
OUT PVOID *pBuffer)
{
- ULONG ReadOffset;
+ LONGLONG ReadOffset;
BOOLEAN Valid;
PROS_SHARED_CACHE_MAP SharedCacheMap;
PROS_VACB Vacb;
NTSTATUS Status;
PINTERNAL_BCB iBcb;
- ULONG ROffset;
+ LONGLONG ROffset;
DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lu, Flags 0x%lx,"
" pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart,
Length, Flags, pBcb, pBuffer);
- ReadOffset = (ULONG)FileOffset->QuadPart;
+ ReadOffset = FileOffset->QuadPart;
ASSERT(FileObject);
ASSERT(FileObject->SectionObjectPointer);
@@ -101,7 +101,7 @@ CcMapData (
}
}
- *pBuffer = (PVOID)((ULONG_PTR)(*pBuffer) + ReadOffset % VACB_MAPPING_GRANULARITY);
+ *pBuffer = (PUCHAR)*pBuffer + ReadOffset % VACB_MAPPING_GRANULARITY;
iBcb = ExAllocateFromNPagedLookasideList(&iBcbLookasideList);
if (iBcb == NULL)
{