qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: ensure core_slot isn't NULL in spapr_core_unplug()
@ 2017-05-18 13:58 Greg Kurz
  2017-05-18 14:59 ` Igor Mammedov
  2017-05-19  1:21 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Kurz @ 2017-05-18 13:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, David Gibson

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>
---
 hw/ppc/spapr.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 0980d733cd7a..1c5b814fc0bf 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2715,6 +2715,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));
 }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-19  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 13:58 [Qemu-devel] [PATCH] spapr: ensure core_slot isn't NULL in spapr_core_unplug() Greg Kurz
2017-05-18 14:59 ` Igor Mammedov
2017-05-19  1:21 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).