]> git.proxmox.com Git - mirror_qemu.git/commitdiff
spapr: fix possible Negative array index read
authorGonglei <arei.gonglei@huawei.com>
Thu, 3 Mar 2016 09:43:42 +0000 (17:43 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 7 Apr 2016 22:07:56 +0000 (00:07 +0200)
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>
hw/ppc/spapr.c

index e7be21e6786c7825fb606d4de9f4ab57d135948c..feaab08c3de1aa754f11889822470a140ca5ce7f 100644 (file)
@@ -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