From 60cddb4179e401a7c5e6cc044ead6d4b742dbf11 Mon Sep 17 00:00:00 2001 From: Hediadyoin1 Date: Tue, 16 May 2023 14:29:59 +0200 Subject: [PATCH] Kernel: Check only for the first equal sign in the kernel command line ... key-value decomposition The RaspberryPi firmware will give us a value for the 'video' key that contains multiple equal signs: ``` video=HDMI-A-1:1920x1080M@30D,margin_left=48,margin_right=48,[...] ``` Instead of asserting that this only has one equal sign, let's just split it by the first one. --- Kernel/CommandLine.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index d52f4ce0e0d..dd08f41f648 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -58,15 +58,13 @@ UNMAP_AFTER_INIT void CommandLine::add_arguments(Vector const& args) if (str == ""sv) { continue; } - - auto pair = str.split_view('='); - VERIFY(pair.size() == 2 || pair.size() == 1); - - if (pair.size() == 1) { - m_params.set(pair[0], ""sv); - } else { - m_params.set(pair[0], pair[1]); - } + // Some boot loaders may include complex key-value pairs where the value is a composite entry, + // we handle this by only checking for the first equals sign in each command line parameter. + auto key = str.find_first_split_view('='); + if (key.length() == str.length()) + m_params.set(key, ""sv); + else + m_params.set(key, str.substring_view(key.length() + 1)); } }