From e01c0494017ab1c14297ad8a4065c4966f63af9a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 7 Apr 2024 20:24:05 +0300 Subject: [PATCH] Kernel: Fix AML buffer parsing --- kernel/kernel/ACPI/AML/DataObject.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/kernel/kernel/ACPI/AML/DataObject.cpp b/kernel/kernel/ACPI/AML/DataObject.cpp index a1e9d7b497..29572590ef 100644 --- a/kernel/kernel/ACPI/AML/DataObject.cpp +++ b/kernel/kernel/ACPI/AML/DataObject.cpp @@ -79,15 +79,9 @@ namespace Kernel::ACPI 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 data; - MUST(data.resize(buffer_size->value)); - for (size_t i = 0; i < buffer_size->value; i++) + MUST(data.resize(BAN::Math::max(buffer_size->value, buffer_span.size()))); + for (size_t i = 0; i < buffer_span.size(); i++) data[i] = buffer_span[i]; return Buffer { .buffer_size = buffer_size.release_value(), .data = BAN::move(data) };