mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:35:07 +00:00
Kernel: Remove KBufferBuilder's can_expand restriction
KBufferBuilder is always allowed to expand if it wants to. This restriction was added a long time ago when it was unsafe to allocate VM while generating ProcFS contents.
This commit is contained in:
parent
fef835de7f
commit
f85b94e6d4
2 changed files with 2 additions and 6 deletions
|
@ -15,8 +15,6 @@ inline bool KBufferBuilder::check_expand(size_t size)
|
|||
return false;
|
||||
if ((m_size + size) < m_buffer->capacity())
|
||||
return true;
|
||||
if (!m_can_expand)
|
||||
return false;
|
||||
if (Checked<size_t>::addition_would_overflow(m_size, size))
|
||||
return false;
|
||||
size_t new_buffer_size = m_size + size;
|
||||
|
@ -42,9 +40,8 @@ OwnPtr<KBuffer> KBufferBuilder::build()
|
|||
return try_make<KBuffer>(move(m_buffer));
|
||||
}
|
||||
|
||||
KBufferBuilder::KBufferBuilder(bool can_expand)
|
||||
KBufferBuilder::KBufferBuilder()
|
||||
: m_buffer(KBufferImpl::try_create_with_size(4 * MiB, Region::Access::Read | Region::Access::Write))
|
||||
, m_can_expand(can_expand)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue