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:
parent
9eab8734fe
commit
ae0dc22716
Notes:
sideshowbarker
2024-07-19 14:41:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ae0dc227165
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue