]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hmp: fix "dump-quest-memory" segfault
authorIwona Kotlarska <iwona260909@gmail.com>
Thu, 30 Mar 2017 05:09:24 +0000 (07:09 +0200)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Fri, 31 Mar 2017 10:53:42 +0000 (11:53 +0100)
Running QEMU with "qemu-system-x86_64 -M none -nographic -m 256" and executing
"dump-guest-memory /dev/null 0 8192" results in segfault.
Fix by checking if we have CPU.

Signed-off-by: Iwona Kotlarska <iwona260909@gmail.com>
Message-Id: <20170330050924.22134-1-iwona260909@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
   Fixed up title

target/i386/arch_dump.c

index 5a2e4be5d003effac58cfa2101156296885b753b..fe0aa36932aa262f7a9d5c36ad3553479613ed79 100644 (file)
@@ -391,8 +391,7 @@ int cpu_get_dump_info(ArchDumpInfo *info,
 
 #ifdef TARGET_X86_64
     X86CPU *first_x86_cpu = X86_CPU(first_cpu);
-
-    lma = !!(first_x86_cpu->env.hflags & HF_LMA_MASK);
+    lma = first_cpu && (first_x86_cpu->env.hflags & HF_LMA_MASK);
 #endif
 
     if (lma) {