Kernel: Fix AML buffer parsing

This commit is contained in:
Bananymous 2024-04-07 20:24:05 +03:00
parent e7ef7a9e55
commit e01c049401
1 changed files with 2 additions and 8 deletions

View File

@ -79,15 +79,9 @@ namespace Kernel::ACPI
AML_TRY_PARSE(buffer_size, AML::Integer, buffer_span); AML_TRY_PARSE(buffer_size, AML::Integer, buffer_span);
if (buffer_span.size() < buffer_size->value)
{
AML_DEBUG_ERROR("Buffer size {} bytes and span only {} bytes", buffer_size->value, buffer_span.size());
return {};
}
BAN::Vector<uint8_t> data; BAN::Vector<uint8_t> data;
MUST(data.resize(buffer_size->value)); MUST(data.resize(BAN::Math::max(buffer_size->value, buffer_span.size())));
for (size_t i = 0; i < buffer_size->value; i++) for (size_t i = 0; i < buffer_span.size(); i++)
data[i] = buffer_span[i]; data[i] = buffer_span[i];
return Buffer { .buffer_size = buffer_size.release_value(), .data = BAN::move(data) }; return Buffer { .buffer_size = buffer_size.release_value(), .data = BAN::move(data) };