mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-12 18:06:56 +02:00
AK+Kernel+Userland: Don't allow Vector::append() in the kernel
This makes it not as easy to forgot to handle OOMs in the kernel. This commit replaces most usages of this function with `try_append(...).release_value_but_fixme_should_propagate_errors()`. But in some cases, using the `TRY` macro or `unchecked_append()` is already possible. In places where allocations should not fail or an OOM would be fatal anyways, `MUST(try_append(...))` should be used explicitly.
This commit is contained in:
@@ -71,7 +71,7 @@ ErrorOr<void> SharedInodeVMObject::sync_impl(off_t offset_in_pages, size_t pages
|
||||
for (size_t page_index = offset_in_pages; page_index < highest_page_to_flush; ++page_index) {
|
||||
auto& physical_page = m_physical_pages[page_index];
|
||||
if (physical_page && is_page_dirty(page_index))
|
||||
pages_to_flush.append(page_index);
|
||||
TRY(pages_to_flush.try_append(page_index));
|
||||
}
|
||||
|
||||
if (pages_to_flush.size() == 0)
|
||||
|
||||
Reference in New Issue
Block a user