summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-04 12:46:19 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-04 13:08:37 +0200
commit4b3bc3805bb5bbed9ec56fa00d12f9038c716a1d (patch)
tree81da5b92a31b99b0b5d67d6c52d18609ef872fb6
parentb02eb8224cd45d6b5c2257bc96b2d59451566906 (diff)
downloadserenity-4b3bc3805bb5bbed9ec56fa00d12f9038c716a1d.zip
Kernel: Add missing error check when opening root file system
-rw-r--r--Kernel/Storage/StorageManagement.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp
index 9b53b991e5..b00062bd84 100644
--- a/Kernel/Storage/StorageManagement.cpp
+++ b/Kernel/Storage/StorageManagement.cpp
@@ -182,11 +182,15 @@ NonnullRefPtr<FileSystem> StorageManagement::root_filesystem() const
if (!boot_device_description) {
PANIC("StorageManagement: Couldn't find a suitable device to boot from");
}
- auto e2fs = Ext2FS::create(FileDescription::try_create(boot_device_description.release_nonnull()).value());
- if (auto result = e2fs->initialize(); result.is_error()) {
+ auto description_or_error = FileDescription::try_create(boot_device_description.release_nonnull());
+ VERIFY(!description_or_error.is_error());
+
+ auto file_system = Ext2FS::create(description_or_error.release_value());
+
+ if (auto result = file_system->initialize(); result.is_error()) {
PANIC("StorageManagement: Couldn't open root filesystem: {}", result);
}
- return e2fs;
+ return file_system;
}
bool StorageManagement::initialized()