From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] spapr: ensure core_slot isn't NULL in spapr_core_unplug()
Date: Fri, 19 May 2017 11:21:17 +1000 [thread overview]
Message-ID: <20170519012117.GA12284@umbus.fritz.box> (raw)
In-Reply-To: <149511591185.8828.11947901967942107196.stgit@bahia.lab.toulouse-stg.fr.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
On Thu, May 18, 2017 at 03:58:31PM +0200, Greg Kurz wrote:
> 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>
Merged to ppc-for-2.10.
> ---
> 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));
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2017-05-19 2:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170519012117.GA12284@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).