qemu/hw/i386
Peter Maydell bd0e501e1a hw/i386/pc: Don't try to init PCI NICs if there is no PCI bus
The 'isapc' machine type has no PCI bus, but pc_nic_init() still
calls pci_init_nic_devices() passing it a NULL bus pointer.  This
causes the clang sanitizer to complain:

$ ./build/clang/qemu-system-i386 -M isapc
../../hw/pci/pci.c:1866:39: runtime error: member access within null pointer of type 'PCIBus' (aka 'struct PCIBus')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../hw/pci/pci.c:1866:39 in

This is because pci_init_nic_devices() does
 &bus->qbus
which is undefined behaviour on a NULL pointer even though we're not
actually dereferencing the pointer. (We don't actually crash as
a result, so if you aren't running a sanitizer build then there
are no user-visible effects.)

Make pc_nic_init() avoid trying to initialize PCI NICs on a non-PCI
system.

Cc: qemu-stable@nongnu.org
Fixes: 8d39f9ba14 ("hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20241105171813.3031969-1-peter.maydell@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-09 08:34:07 +01:00
..
kvm hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
xen hw/xen: xenpvh: Disable buffered IOREQs for ARM 2024-10-03 19:37:35 +02:00
acpi-build.c amd_iommu: Rename variable mmio to mr_mmio 2024-11-04 16:03:24 -05:00
acpi-build.h
acpi-common.c
acpi-common.h
acpi-microvm.c
acpi-microvm.h
amd_iommu-stub.c
amd_iommu.c amd_iommu: Check APIC ID > 255 for XTSup 2024-11-04 16:03:24 -05:00
amd_iommu.h amd_iommu: Use shared memory region for Interrupt Remapping 2024-11-04 16:03:24 -05:00
e820_memory_layout.c
e820_memory_layout.h
fw_cfg.c
fw_cfg.h
intel_iommu_internal.h intel_iommu: Add missed reserved bit check for IEC descriptor 2024-11-04 16:03:25 -05:00
intel_iommu.c intel_iommu: Add missed reserved bit check for IEC descriptor 2024-11-04 16:03:25 -05:00
Kconfig machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
meson.build machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
microvm-dt.c hw/char/serial.h: Extract serial-isa.h 2024-10-03 19:33:23 +02:00
microvm-dt.h
microvm.c machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
monitor.c
multiboot.c hw/i386: Use explicit little-endian LD/ST API 2024-10-15 12:13:59 -03:00
multiboot.h
nitro_enclave.c machine/nitro-enclave: New machine type for AWS Nitro Enclaves 2024-10-31 18:28:33 +01:00
pc_piix.c hw: add compat machines for 9.2 2024-09-05 13:12:36 +01:00
pc_q35.c hw: add compat machines for 9.2 2024-09-05 13:12:36 +01:00
pc_sysfw_ovmf-stubs.c
pc_sysfw_ovmf.c
pc_sysfw.c
pc.c hw/i386/pc: Don't try to init PCI NICs if there is no PCI bus 2024-11-09 08:34:07 +01:00
port92.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
sgx-epc.c
sgx-stub.c target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine 2024-07-31 13:13:31 +02:00
sgx.c target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine 2024-07-31 13:13:31 +02:00
trace-events
trace.h
vapic.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
vmmouse.c hw: Use device_class_set_legacy_reset() instead of opencoding 2024-09-13 15:31:44 +01:00
vmport.c
x86-common.c hw/core: Make CPU topology enumeration arch-agnostic 2024-11-05 23:32:25 +00:00
x86-cpu.c
x86-iommu-stub.c
x86-iommu.c
x86.c