mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 18:47:41 +00:00
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
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
|
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.
|
// 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.
|
// This code allows access outside of the known used address ranges to get caught.
|
||||||
auto kmc_result = check_kernel_memory_access(laddr, false);
|
auto kmc_result = check_kernel_memory_access(laddr, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue