summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2016-03-03 17:43:42 +0800
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 20:01:35 -0600
commit4009acfe4abed4e99b1972c89b8509099a45065d (patch)
tree270bc4351f7c587fab138d66b00827bf3e638c75
parent4c92e3ba6966d03f9e60e8ba41a92d30251ad04f (diff)
downloadhqemu-4009acfe4abed4e99b1972c89b8509099a45065d.zip
hqemu-4009acfe4abed4e99b1972c89b8509099a45065d.tar.gz
spapr: fix possible Negative array index read
fix CID 1351391. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Message-Id: <1456998223-12356-6-git-send-email-arei.gonglei@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/ppc/spapr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e7be21e..feaab08 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2208,6 +2208,10 @@ static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
if (*errp) {
return;
}
+ if (node < 0 || node >= MAX_NODES) {
+ error_setg(errp, "Invaild node %d", node);
+ return;
+ }
/*
* Currently PowerPC kernel doesn't allow hot-adding memory to
OpenPOWER on IntegriCloud