From 5750f87396c5e883a3cf0012588119d3ec5052b8 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 21 Nov 2024 13:46:09 +0200 Subject: [PATCH] Kernel: Fix unaligned access in xHCI controller initialization --- kernel/kernel/USB/XHCI/Controller.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/kernel/USB/XHCI/Controller.cpp b/kernel/kernel/USB/XHCI/Controller.cpp index cc801133..02691ddb 100644 --- a/kernel/kernel/USB/XHCI/Controller.cpp +++ b/kernel/kernel/USB/XHCI/Controller.cpp @@ -159,7 +159,13 @@ namespace Kernel { auto& protocol = reinterpret_cast(ext_cap); - if (protocol.name_string != *reinterpret_cast("USB ")) + const uint32_t target_name_string { + ('U' << 0) | + ('S' << 8) | + ('B' << 16) | + (' ' << 24) + }; + if (protocol.name_string != target_name_string) { dwarnln("Invalid port protocol name string"); return BAN::Error::from_errno(EFAULT);