Kernel: Make validate_read_from_kernel() return early for nullptr checks.

Null pointers are always invalid, so don't bother going through all the
various checks for them.
This commit is contained in:
Andreas Kling 2019-04-15 23:48:31 +02:00
parent 9eab8734fe
commit ae0dc22716
Notes: sideshowbarker 2024-07-19 14:41:57 +09:00

View File

@ -1371,6 +1371,8 @@ static KernelMemoryCheckResult check_kernel_memory_access(LinearAddress laddr, b
bool Process::validate_read_from_kernel(LinearAddress laddr) const
{
if (laddr.is_null())
return false;
// We check extra carefully here since the first 4MB of the address space is identity-mapped.
// This code allows access outside of the known used address ranges to get caught.
auto kmc_result = check_kernel_memory_access(laddr, false);