qemu-patch-raspberry4/hw/ppc
Philippe Mathieu-Daudé 740a19313b spapr_pci: Fix potential NULL pointer dereference in spapr_dt_pci_bus()
Commit 14e714900f refactored the call to spapr_dt_drc(),
introducing a potential NULL pointer dereference while
accessing bus->parent_dev.
A trivial audit show 'bus' is not null in the two places
the static function spapr_dt_drc() is called.

Since the 'bus' parameter is not NULL in both callers, remove
remove the test on if (bus), and add an assert() to silent
static analyzers.

This fixes:

  /hw/ppc/spapr_pci.c: 1367 in spapr_dt_pci_bus()
  >>>     CID 1401933:  Null pointer dereferences  (FORWARD_NULL)
  >>>     Dereferencing null pointer "bus".
  1367         ret = spapr_dt_drc(fdt, offset, OBJECT(bus->parent_dev),
  1368                            SPAPR_DR_CONNECTOR_TYPE_PCI);

Fixes: 14e714900f
Reported-by: Coverity (CID 1401933)
Suggested-by: Greg Kurz <groug@kaod.org>
Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190613213406.22053-1-philmd@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-07-02 09:43:58 +10:00
..
e500-ccsr.h ppc: do not use ../ in include files 2013-03-01 13:57:33 +01:00
e500.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
e500.h platform-bus-device: use device plug callback instead of machine_done notifier 2018-05-10 18:10:56 +01:00
e500plat.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
fdt.c target/ppc: Split page size information into a separate allocation 2018-04-27 18:05:22 +10:00
fw_cfg.c hw/ppc: Implement fw_cfg_arch_key_name() 2019-05-23 14:10:31 +02:00
Kconfig spapr/xive: add KVM support 2019-05-29 11:39:45 +10:00
mac.h macio: move MACIOIDEState type declarations to macio.h 2018-08-30 10:42:18 +10:00
mac_newworld.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
mac_oldworld.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
Makefile.objs hw/ppc: Implement fw_cfg_arch_key_name() 2019-05-23 14:10:31 +02:00
mpc8544_guts.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
mpc8544ds.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
pnv.c ppc/pnv: remove xscom_base field from PnvChip 2019-07-02 09:43:58 +10:00
pnv_bmc.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
pnv_core.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pnv_lpc.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pnv_occ.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pnv_psi.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
pnv_xscom.c ppc/pnv: fix XSCOM MMIO base address for P9 machines with multiple chips 2019-07-02 09:43:58 +10:00
ppc.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ppc4xx_devs.c ppc4xx: Pass array index to function instead of pointer into the array 2019-02-04 18:44:17 +11:00
ppc4xx_pci.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ppc405.h ppc4xx: Export ECB and PLB emulation 2017-09-08 09:30:55 +10:00
ppc405_boards.c pflash: Clean up after commit 368a354f02, part 2 2019-03-11 22:53:44 +01:00
ppc405_uc.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ppc440.h ppc440_uc: Basic emulation of PPC440 DMA controller 2018-07-03 09:56:52 +10:00
ppc440_bamboo.c elf: Add optional function ptr to load_elf() to parse ELF notes 2019-02-05 16:50:16 +01:00
ppc440_pcix.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ppc440_uc.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
ppc_booke.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ppce500_spin.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
prep.c hw/ppc/40p: use 1900 as a base year 2019-05-29 11:39:44 +10:00
prep_systemio.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
rs6000_mc.c hw/ppc: Use the IEC binary prefix definitions 2018-07-02 15:41:16 +02:00
sam460ex.c pflash: Clean up after commit 368a354f02, part 2 2019-03-11 22:53:44 +01:00
spapr.c ppc patch queue 2019-06-12 2019-06-12 14:43:47 +01:00
spapr_caps.c qemu-common: Move tcg_enabled() etc. to sysemu/tcg.h 2019-06-11 20:22:09 +02:00
spapr_cpu_core.c target/ppc: Set PSSCR_EC on cpu halt to prevent spurious wakeup 2019-05-29 11:39:45 +10:00
spapr_drc.c spapr: Clean up spapr_drc_populate_dt() 2019-06-12 10:41:49 +10:00
spapr_events.c spapr: Use CamelCase properly 2019-03-12 14:33:05 +11:00
spapr_hcall.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spapr_iommu.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spapr_irq.c spapr/irq: add KVM support to the 'dual' machine 2019-05-29 11:39:46 +10:00
spapr_ovec.c spapr: Use CamelCase properly 2019-03-12 14:33:05 +11:00
spapr_pci.c spapr_pci: Fix potential NULL pointer dereference in spapr_dt_pci_bus() 2019-07-02 09:43:58 +10:00
spapr_pci_nvlink2.c spapr: Support NVIDIA V100 GPU with NVLink2 2019-04-26 10:41:23 +10:00
spapr_pci_vfio.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
spapr_rng.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spapr_rtas.c target/ppc: Set PSSCR_EC on cpu halt to prevent spurious wakeup 2019-05-29 11:39:45 +10:00
spapr_rtas_ddw.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
spapr_rtc.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
spapr_vio.c spapr: Use CamelCase properly 2019-03-12 14:33:05 +11:00
trace-events trace-events: Fix attribution of trace points to source 2019-03-22 16:18:07 +00:00
virtex_ml507.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00