summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-15 00:13:44 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-15 00:17:55 +0200
commit16221305ade1e37d68c95d9bf674021afc18570f (patch)
treec4f1a8704da4e5f9b87641a3ba11a878ad493f13 /Kernel
parentf70d0f03de9eec4ee790f7bc7671d0c399be5e94 (diff)
downloadserenity-16221305ade1e37d68c95d9bf674021afc18570f.zip
LibELF: Remove sketchy use of "undefined" ELF::Image::Section
We were using ELF::Image::section(0) to indicate the "undefined" section, when what we really wanted was just Optional<Section>. So let's use Optional instead. :^)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Syscalls/module.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Syscalls/module.cpp b/Kernel/Syscalls/module.cpp
index de12de98e3..1389cb8f16 100644
--- a/Kernel/Syscalls/module.cpp
+++ b/Kernel/Syscalls/module.cpp
@@ -65,7 +65,9 @@ KResultOr<int> Process::sys$module_load(Userspace<const char*> user_path, size_t
return IterationDecision::Continue;
auto* section_storage = section_storage_by_name.get(section.name()).value_or(nullptr);
VERIFY(section_storage);
- section.relocations().for_each_relocation([&](const ELF::Image::Relocation& relocation) {
+ auto relocations = section.relocations();
+ VERIFY(relocations.has_value());
+ relocations->for_each_relocation([&](const ELF::Image::Relocation& relocation) {
auto& patch_ptr = *reinterpret_cast<ptrdiff_t*>(section_storage + relocation.offset());
switch (relocation.type()) {
case R_386_PC32: {