bd0e501e1a
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:
|
||
---|---|---|
.. | ||
kvm | ||
xen | ||
acpi-build.c | ||
acpi-build.h | ||
acpi-common.c | ||
acpi-common.h | ||
acpi-microvm.c | ||
acpi-microvm.h | ||
amd_iommu-stub.c | ||
amd_iommu.c | ||
amd_iommu.h | ||
e820_memory_layout.c | ||
e820_memory_layout.h | ||
fw_cfg.c | ||
fw_cfg.h | ||
intel_iommu_internal.h | ||
intel_iommu.c | ||
Kconfig | ||
meson.build | ||
microvm-dt.c | ||
microvm-dt.h | ||
microvm.c | ||
monitor.c | ||
multiboot.c | ||
multiboot.h | ||
nitro_enclave.c | ||
pc_piix.c | ||
pc_q35.c | ||
pc_sysfw_ovmf-stubs.c | ||
pc_sysfw_ovmf.c | ||
pc_sysfw.c | ||
pc.c | ||
port92.c | ||
sgx-epc.c | ||
sgx-stub.c | ||
sgx.c | ||
trace-events | ||
trace.h | ||
vapic.c | ||
vmmouse.c | ||
vmport.c | ||
x86-common.c | ||
x86-cpu.c | ||
x86-iommu-stub.c | ||
x86-iommu.c | ||
x86.c |