1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Kernel: Handle OOM from KBuffer usage in Ext2FS::get_bitmap_block()

Fixes up error handling on an OOM-able path, and removes one more usage
of KBuffer::create_with_size.
This commit is contained in:
Brian Gianforcaro 2021-08-01 02:21:20 -07:00 committed by Andreas Kling
parent 43f930d3aa
commit 15cd5d324c
2 changed files with 9 additions and 7 deletions

View file

@ -168,15 +168,15 @@ private:
bool m_block_group_descriptors_dirty { false };
struct CachedBitmap {
CachedBitmap(BlockIndex bi, KBuffer&& buf)
CachedBitmap(BlockIndex bi, NonnullOwnPtr<KBuffer> buf)
: bitmap_block_index(bi)
, buffer(move(buf))
{
}
BlockIndex bitmap_block_index { 0 };
bool dirty { false };
KBuffer buffer;
BitmapView bitmap(u32 blocks_per_group) { return BitmapView { buffer.data(), blocks_per_group }; }
NonnullOwnPtr<KBuffer> buffer;
BitmapView bitmap(u32 blocks_per_group) { return BitmapView { buffer->data(), blocks_per_group }; }
};
KResultOr<CachedBitmap*> get_bitmap_block(BlockIndex);