summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorIwona Kotlarska <iwona260909@gmail.com>2017-03-30 07:09:24 +0200
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-03-31 11:53:42 +0100
commitfd5d23babf9838c1b099a9e8020e778aac0ebb4d (patch)
treeaaeb887275f48cf1224f6e5eeee22a5c088208f6 /target
parent05a6f451eb0e3224a8e6d98089379f20ec06c787 (diff)
downloadqemu-fd5d23babf9838c1b099a9e8020e778aac0ebb4d.tar.gz
hmp: fix "dump-quest-memory" segfault
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
Diffstat (limited to 'target')
-rw-r--r--target/i386/arch_dump.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c
index 5a2e4be5d0..fe0aa36932 100644
--- a/target/i386/arch_dump.c
+++ b/target/i386/arch_dump.c
@@ -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) {