[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH] qemu crashes when a negative number used for 'maxcpus

From: Seeteena Thoufeek
Subject: [Qemu-ppc] [PATCH] qemu crashes when a negative number used for 'maxcpus'
Date: Mon, 28 Aug 2017 15:21:50 +0530

---Steps to Reproduce---

When passed a negative number to 'maxcpus' parameter. Qemu aborts with
 a core dump.

Run the following command with maxcpus argument as negative number

ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine 
pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci,
drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2,
if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet
:,server,nowait -net nic,model=virtio -net
user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1,

(process:12149): GLib-ERROR **: gmem.c:130: failed to allocate
 18446744073709550568 bytes

Trace/breakpoint trap

Reported-by: R.Nageswara Sastry <address@hidden>
Signed-off-by: Seeteena Thoufeek <address@hidden>
 hw/ppc/spapr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index cec441c..0cb4198 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3310,7 +3310,10 @@ static const CPUArchIdList 
*spapr_possible_cpu_arch_ids(MachineState *machine)
     int i;
     int spapr_max_cores = max_cpus / smp_threads;
     MachineClass *mc = MACHINE_GET_CLASS(machine);
+    if (max_cpus < 0) {
+       error_report("Invalid max CPUs %d", max_cpus);
+       exit(1);
+    }
     if (!mc->has_hotpluggable_cpus) {
         spapr_max_cores = QEMU_ALIGN_UP(smp_cpus, smp_threads) / smp_threads;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]