Kernel: Make KBuffer::try_create_with_bytes() actually copy the bytes

KBuffers created with this API were actually just zero-filled instead
of being populated with the provided bytes.

Fixes #4493.
This commit is contained in:
Andreas Kling 2020-12-23 00:38:43 +01:00
parent 99d6b3b80b
commit c77dda6827

View file

@ -63,6 +63,7 @@ public:
return nullptr;
if (!region->commit())
return nullptr;
memcpy(region->vaddr().as_ptr(), bytes.data(), bytes.size());
return adopt(*new KBufferImpl(region.release_nonnull(), bytes.size()));
}