Kernel: Fix AML buffer parsing
This commit is contained in:
parent
e7ef7a9e55
commit
e01c049401
|
@ -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) };
|
||||||
|
|
Loading…
Reference in New Issue