From c705afa43a2cd71697177776a749562557d1b01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= Date: Fri, 10 Mar 2023 12:08:47 +0100 Subject: [PATCH] Kernel: Fix variable shadowing issue in PCIIDELegacyModeController In this specific else case, primary_base_io_window would not be assigned in the outer scope, leading to a crash immediately after. --- Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp b/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp index 219137d91d..6fb3a0e99f 100644 --- a/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp +++ b/Kernel/Arch/x86_64/PCI/IDELegacyModeController.cpp @@ -106,7 +106,7 @@ UNMAP_AFTER_INIT ErrorOr PCIIDELegacyModeController::initialize_and_enumer primary_base_io_window = TRY(IOWindow::create_for_io_space(IOAddress(0x1F0), 8)); primary_control_io_window = TRY(IOWindow::create_for_io_space(IOAddress(0x3F6), 4)); } else { - auto primary_base_io_window = TRY(IOWindow::create_for_pci_device_bar(device_identifier(), PCI::HeaderType0BaseRegister::BAR0)); + primary_base_io_window = TRY(IOWindow::create_for_pci_device_bar(device_identifier(), PCI::HeaderType0BaseRegister::BAR0)); auto pci_primary_control_io_window = TRY(IOWindow::create_for_pci_device_bar(device_identifier(), PCI::HeaderType0BaseRegister::BAR1)); // Note: the PCI IDE specification says we should access the IO address with an offset of 2 // on native PCI IDE controllers.