summaryrefslogtreecommitdiff
path: root/Kernel/Memory/AddressSpace.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-08-19 22:45:07 +0300
committerAndreas Kling <kling@serenityos.org>2021-08-19 23:49:53 +0200
commitcf271183b4befeba7c96bd6ca25246b899e836bb (patch)
tree0361e7378750c2c4e45e5e01e273d6fe416555af /Kernel/Memory/AddressSpace.cpp
parent1259dc362376e8011d20d4d9e2fcc49d5b7f9dc9 (diff)
downloadserenity-cf271183b4befeba7c96bd6ca25246b899e836bb.zip
Kernel: Make Process::current() return a Process& instead of Process*
This has several benefits: 1) We no longer just blindly derefence a null pointer in various places 2) We will get nicer runtime error messages if the current process does turn out to be null in the call location 3) GCC no longer complains about possible nullptr dereferences when compiling without KUBSAN
Diffstat (limited to 'Kernel/Memory/AddressSpace.cpp')
-rw-r--r--Kernel/Memory/AddressSpace.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp
index 1467f5922e..3dc0d4cd43 100644
--- a/Kernel/Memory/AddressSpace.cpp
+++ b/Kernel/Memory/AddressSpace.cpp
@@ -53,7 +53,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
if (!whole_region->is_mmap())
return EPERM;
- PerformanceManager::add_unmap_perf_event(*Process::current(), whole_region->range());
+ PerformanceManager::add_unmap_perf_event(Process::current(), whole_region->range());
deallocate_region(*whole_region);
return KSuccess;
@@ -83,7 +83,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
new_region->map(page_directory());
}
- PerformanceManager::add_unmap_perf_event(*Process::current(), range_to_unmap);
+ PerformanceManager::add_unmap_perf_event(Process::current(), range_to_unmap);
return KSuccess;
}
@@ -133,7 +133,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size)
new_region->map(page_directory());
}
- PerformanceManager::add_unmap_perf_event(*Process::current(), range_to_unmap);
+ PerformanceManager::add_unmap_perf_event(Process::current(), range_to_unmap);
return KSuccess;
}