From: Iwona Kotlarska <iwona260909@gmail.com>
Cc: qemu-devel@nongnu.org, marcel@redhat.com, pbonzini@redhat.com,
rth@twiddle.net, ehabkost@redhat.com,
Iwona Kotlarska <iwona260909@gmail.com>
Subject: [Qemu-devel] [PATCH] hmp: fix "info cpu" segfault
Date: Wed, 29 Mar 2017 18:52:51 +0200 [thread overview]
Message-ID: <20170329165251.28740-1-iwona260909@gmail.com> (raw)
Running "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>
---
target/i386/arch_dump.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c
index 5a2e4be5d0..45cda6afb1 100644
--- a/target/i386/arch_dump.c
+++ b/target/i386/arch_dump.c
@@ -390,9 +390,10 @@ int cpu_get_dump_info(ArchDumpInfo *info,
GuestPhysBlock *block;
#ifdef TARGET_X86_64
- X86CPU *first_x86_cpu = X86_CPU(first_cpu);
-
- lma = !!(first_x86_cpu->env.hflags & HF_LMA_MASK);
+ X86CPU *first_x86_cpu = NULL;
+ first_x86_cpu = X86_CPU(first_cpu);
+ if (first_cpu != NULL)
+ lma = !!(first_x86_cpu->env.hflags & HF_LMA_MASK);
#endif
if (lma) {
--
2.12.0
next reply other threads:[~2017-03-29 16:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-29 16:52 Iwona Kotlarska [this message]
2017-03-29 17:38 ` [Qemu-devel] [PATCH] hmp: fix "info cpu" segfault Marcel Apfelbaum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170329165251.28740-1-iwona260909@gmail.com \
--to=iwona260909@gmail.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).