1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

Kernel/VirtIO: Ignore Configurations that have length of zero bytes

These configurations are simply invalid. Ignoring those allow us to boot
with the virtio-gpu-pci device (in addition to the already supported
virtio-vga PCI device).
This commit is contained in:
Liav A 2023-03-07 21:04:39 +02:00 committed by Jelle Raaijmakers
parent d4d49e00a2
commit 95b15e4901

View file

@ -113,6 +113,9 @@ UNMAP_AFTER_INIT void Device::initialize()
}
config.offset = capability.read32(0x8);
config.length = capability.read32(0xc);
// NOTE: Configuration length of zero is an invalid configuration that should be ignored.
if (config.length == 0)
continue;
dbgln_if(VIRTIO_DEBUG, "{}: Found configuration {}, bar: {}, offset: {}, length: {}", m_class_name, (u32)config.cfg_type, config.bar, config.offset, config.length);
if (config.cfg_type == ConfigurationType::Common)
m_use_mmio = true;