https://git.reactos.org/?p=reactos.git;a=commitdiff;h=41250d1028b2decd97c28…
commit 41250d1028b2decd97c282f03f21a9c83d4c1e9b
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Mon Apr 15 23:22:01 2019 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun Sep 1 14:15:07 2019 +0200
[NTOS:MM] Fix MmspCompareSegments
On x64 the previous implementation would only compare the upper 32 bits and ignore the
lower 32 bits.
---
ntoskrnl/mm/section.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index 69ffe53f6dc..1d7a043c2a1 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -3306,9 +3306,12 @@ MmspCompareSegments(const void * x,
const MM_SECTION_SEGMENT *Segment1 = (const MM_SECTION_SEGMENT *)x;
const MM_SECTION_SEGMENT *Segment2 = (const MM_SECTION_SEGMENT *)y;
- return
- (Segment1->Image.VirtualAddress - Segment2->Image.VirtualAddress) >>
- ((sizeof(ULONG_PTR) - sizeof(int)) * 8);
+ if (Segment1->Image.VirtualAddress > Segment2->Image.VirtualAddress)
+ return 1;
+ else if (Segment1->Image.VirtualAddress < Segment2->Image.VirtualAddress)
+ return -1;
+ else
+ return 0;
}
/*