https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fe416b67dca395e4ad02aa...
commit fe416b67dca395e4ad02aa9e6eb83733ea3ee63b Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Thu Jun 17 00:29:58 2021 +0200 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Thu Jun 17 00:35:21 2021 +0200
[NTOS:IO] Revert part of commit a82ff90b2: don't do direct ULONG data access: it might be unaligned.
Requested by Victor. --- ntoskrnl/io/iomgr/driver.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c index 6a42dd30f7a..edb64baef7b 100644 --- a/ntoskrnl/io/iomgr/driver.c +++ b/ntoskrnl/io/iomgr/driver.c @@ -213,7 +213,10 @@ IopGetDriverNames( status = STATUS_ILL_FORMED_SERVICE_ENTRY; goto Cleanup; } - driverType = *(PULONG)((ULONG_PTR)kvInfo + kvInfo->DataOffset); + + RtlMoveMemory(&driverType, + (PVOID)((ULONG_PTR)kvInfo + kvInfo->DataOffset), + sizeof(ULONG)); ExFreePool(kvInfo);
/* Compute the necessary driver name string size */ @@ -913,7 +916,10 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY BootLdrEntry) ExFreePool(kvInfo); goto Cleanup; } - instanceCount = *(PULONG)((ULONG_PTR)kvInfo + kvInfo->DataOffset); + + RtlMoveMemory(&instanceCount, + (PVOID)((ULONG_PTR)kvInfo + kvInfo->DataOffset), + sizeof(ULONG)); ExFreePool(kvInfo);
DPRINT("Processing %u instances for %wZ module\n", instanceCount, ModuleName);