Kernel: Use correctly-sized read when checking PCI host bridge function

We were accidentally doing a 16-bit read instead of an 8-bit read,
meaning we would also read the 'CACHE_LINE_SIZE' field immediately
following it, and never actually continue.
This commit is contained in:
Idan Horowitz 2024-04-22 13:46:20 +03:00 committed by Andreas Kling
parent c4750f6eec
commit 519be6e626
Notes: sideshowbarker 2024-07-16 23:59:28 +09:00

View file

@ -121,7 +121,7 @@ UNMAP_AFTER_INIT void HostController::enumerate_attached_devices(Function<Iterat
for (int bus_as_function_number = 1; bus_as_function_number < 8; ++bus_as_function_number) {
if (read16_field(0, 0, bus_as_function_number, PCI::RegisterOffset::VENDOR_ID) == PCI::none_value)
continue;
if (read16_field(0, 0, bus_as_function_number, PCI::RegisterOffset::CLASS) != 0x6)
if (read8_field(0, 0, bus_as_function_number, PCI::RegisterOffset::CLASS) != 0x6)
continue;
if (Checked<u8>::addition_would_overflow(m_domain.start_bus(), bus_as_function_number))
break;