diff options
author | Greg Kurz <groug@kaod.org> | 2017-05-18 15:58:31 +0200 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-05-24 11:39:53 +1000 |
commit | 07572c0653a60769df406c16136e2cc9234692f5 (patch) | |
tree | fc27bbe4479ab1c1c12100f996264d897847265c /hw | |
parent | de86eccc0c836adfa8dbb94848096720177f5ccb (diff) |
spapr: ensure core_slot isn't NULL in spapr_core_unplug()
If we go that far on the path of hot-removing a core and we find out that
the core-id is invalid, then we have a serious bug.
Let's make it explicit with an assert() instead of dereferencing a NULL
pointer.
This fixes Coverity issue CID 1375404.
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/ppc/spapr.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 35dceb024e..c912eaa2be 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2725,6 +2725,7 @@ static void spapr_core_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, CPUCore *cc = CPU_CORE(dev); CPUArchId *core_slot = spapr_find_cpu_slot(ms, cc->core_id, NULL); + assert(core_slot); core_slot->cpu = NULL; object_unparent(OBJECT(dev)); } |