aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/macio.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2018-08-24 17:30:04 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2018-08-28 11:31:23 +1000
commitbc9b1f10f29dd7e717e6b5a050cbe5fbe8537200 (patch)
treee6b512d8c965cdf895641f94596de10d4a89fcbb /hw/ide/macio.c
parenteceba3477e7fa9b2c0a711a60edbdb7bfa8e4dcd (diff)
downloadqemu-bc9b1f10f29dd7e717e6b5a050cbe5fbe8537200.zip
qemu-bc9b1f10f29dd7e717e6b5a050cbe5fbe8537200.tar.gz
qemu-bc9b1f10f29dd7e717e6b5a050cbe5fbe8537200.tar.bz2
spapr_pci: fix potential NULL pointer dereference
Commit 2c88b098e76fd added a call to SPAPR_MACHINE_GET_CLASS(spapr) in spapr_phb_realize() before we check spapr isn't NULL. This causes QEMU to crash when starting a non-pseries machine with a sPAPR PHB. This could be fixed by setting the smc variable after the null check, but it seems more explicit to use a ternary operator to skip the call to SPAPR_MACHINE_GET_CLASS() if spapr is NULL, since spapr_phb_realize() will return immediately in this case. This was reported by Coverity (CID 1395170 and 1395183). Fixes: 2c88b098e76fde0c7fcc0476dd3f80ce58409505 Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ide/macio.c')
0 files changed, 0 insertions, 0 deletions